Input roll - fix up HDC handling and a few other things
This commit is contained in:
parent
0b9bb8095c
commit
4b152770a4
|
@ -48,6 +48,12 @@ namespace BizHawk.Client.EmuHawk.CustomControls
|
|||
_hdc = GetDC(c.Handle);
|
||||
}
|
||||
|
||||
public void NewHdc(IntPtr hdc)
|
||||
{
|
||||
_hdc = hdc;
|
||||
SetBkMode(_hdc, (int)BkModes.OPAQUE);
|
||||
}
|
||||
|
||||
System.Windows.Forms.Control _c;
|
||||
|
||||
/// <summary>
|
||||
|
@ -57,7 +63,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
|
|||
{
|
||||
_g = g;
|
||||
_hdc = _g.GetHdc();
|
||||
SetBkMode(_hdc, 1);
|
||||
SetBkMode(_hdc, (int)BkModes.OPAQUE);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -106,7 +112,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
|
|||
/// <param name="font">the font to use to draw the string</param>
|
||||
/// <param name="color">the text color to set</param>
|
||||
/// <param name="point">the location to start string draw (top-left)</param>
|
||||
public void DrawString(String str, Font font, Color color, Point point)
|
||||
public void DrawString(String str, Font font, Point point)
|
||||
{
|
||||
TextOut(_hdc, point.X, point.Y, str, str.Length);
|
||||
}
|
||||
|
@ -426,4 +432,10 @@ namespace BizHawk.Client.EmuHawk.CustomControls
|
|||
DC_BRUSH = 18,
|
||||
DC_PEN = 19,
|
||||
}
|
||||
|
||||
public enum BkModes
|
||||
{
|
||||
TRANSPARENT = 1,
|
||||
OPAQUE = 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,7 +214,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
int start = 0;
|
||||
foreach (var column in Columns)
|
||||
{
|
||||
gdi.DrawString(column.Text, this.Font, Color.Black, new Point(CellPadding, start + CellPadding));
|
||||
var point = new Point(CellPadding, start + CellPadding);
|
||||
gdi.PrepDrawString(column.Text, this.Font, this.ForeColor, point);
|
||||
gdi.DrawString(column.Text, this.Font, point);
|
||||
start += CellHeight;
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +227,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var point = new Point(start + CellPadding, CellPadding);
|
||||
gdi.PrepDrawString(column.Text, this.Font, this.ForeColor, point);
|
||||
gdi.DrawString(column.Text, this.Font, Color.Black, point);
|
||||
gdi.DrawString(column.Text, this.Font, point);
|
||||
start += CalcWidth(column);
|
||||
}
|
||||
}
|
||||
|
@ -235,6 +237,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Gdi.NewHdc(e.Graphics.GetHdc());
|
||||
|
||||
// Header
|
||||
if (Columns.Any())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue