IControlRenderer - simplify api
This commit is contained in:
parent
21a0b65305
commit
bcfdd79f2a
|
@ -70,7 +70,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
|
|||
_graphics.DrawLine(_currentPen, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
public IDisposable LockGraphics(Graphics g, int width, int height)
|
||||
public IDisposable LockGraphics(Graphics g)
|
||||
{
|
||||
_graphics = g;
|
||||
return new GdiPlusGraphicsLock();
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
|
|||
/// <summary>
|
||||
/// Required to use before calling drawing methods
|
||||
/// </summary>
|
||||
IDisposable LockGraphics(Graphics g, int width, int height);
|
||||
IDisposable LockGraphics(Graphics g);
|
||||
|
||||
/// <summary>
|
||||
/// Measure the width and height of string <paramref name="str"/> when drawn
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
using (_renderer.LockGraphics(e.Graphics, Width, Height))
|
||||
using (_renderer.LockGraphics(e.Graphics))
|
||||
{
|
||||
// White Background
|
||||
_renderer.SetBrush(Color.White);
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (column != null)
|
||||
{
|
||||
using var g = CreateGraphics();
|
||||
using (_renderer.LockGraphics(g, Width, Height))
|
||||
using (_renderer.LockGraphics(g))
|
||||
{
|
||||
var strLength = (int)_renderer.MeasureString(text, Font).Width + (CellWidthPadding * 2);
|
||||
if (column.Width < strLength)
|
||||
|
@ -1951,7 +1951,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void UpdateCellSize()
|
||||
{
|
||||
using (var g = CreateGraphics())
|
||||
using (_renderer.LockGraphics(g, Width, Height))
|
||||
using (_renderer.LockGraphics(g))
|
||||
{
|
||||
// Measure width change to ignore extra padding at start/end
|
||||
var size1 = _renderer.MeasureString("A", Font);
|
||||
|
|
Loading…
Reference in New Issue