Input Roll - better releasing of the hdc, fixes buginess and improves performance, also properly dispose on close

This commit is contained in:
adelikat 2014-08-09 17:15:05 +00:00
parent 0a0c75fb16
commit 51210b643d
3 changed files with 26 additions and 1 deletions

View File

@ -50,6 +50,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
public void NewHdc(IntPtr hdc) public void NewHdc(IntPtr hdc)
{ {
ReleaseDC(_c.Handle, _hdc);
_hdc = hdc; _hdc = hdc;
SetBkMode(_hdc, (int)BkModes.TRANSPARENT); SetBkMode(_hdc, (int)BkModes.TRANSPARENT);
} }

View File

@ -34,6 +34,12 @@ namespace BizHawk.Client.EmuHawk
_charSize = Gdi.MeasureString("A", this.Font); _charSize = Gdi.MeasureString("A", this.Font);
} }
protected override void Dispose(bool disposing)
{
Gdi.Dispose();
base.Dispose(disposing);
}
#region Properties #region Properties
/// <summary> /// <summary>
@ -233,7 +239,10 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private void DrawData(GDIRenderer gdi, PaintEventArgs e)
{
}
protected override void OnPaint(PaintEventArgs e) protected override void OnPaint(PaintEventArgs e)
{ {
@ -250,6 +259,7 @@ namespace BizHawk.Client.EmuHawk
DrawBg(Gdi, e); DrawBg(Gdi, e);
// ForeGround // ForeGround
DrawData(Gdi, e);
} }
#endregion #endregion

View File

@ -51,6 +51,20 @@ namespace BizHawk.Client.EmuHawk
public TasStudioExperiment() public TasStudioExperiment()
{ {
InitializeComponent(); InitializeComponent();
InputView.QueryItemText += TasView_QueryItemText;
InputView.QueryItemBkColor += TasView_QueryItemBkColor;
}
private void TasView_QueryItemText(int index, int column, out string text)
{
Random r = new Random((int)DateTime.Now.Ticks);
text = r.NextDouble() > .5 ? "_" : "";
}
private void TasView_QueryItemBkColor(int index, int column, ref Color color)
{
} }
private void TasStudioExperiment_Load(object sender, EventArgs e) private void TasStudioExperiment_Load(object sender, EventArgs e)