Replace `LuaPictureBox` prop init with constructor

This commit is contained in:
YoshiRulz 2024-08-25 16:38:04 +10:00
parent e5e055b7a4
commit b51bb85c82
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 5 additions and 5 deletions

View File

@ -305,7 +305,7 @@ namespace BizHawk.Client.EmuHawk
return 0; return 0;
} }
var pictureBox = new LuaPictureBox { TableHelper = _th }; LuaPictureBox pictureBox = new(_th);
form.Controls.Add(pictureBox); form.Controls.Add(pictureBox);
const string FUNC_NAME = "forms.pictureBox"; const string FUNC_NAME = "forms.pictureBox";
ProcessPositionArguments(x: x, y: y, pictureBox, functionName: FUNC_NAME); ProcessPositionArguments(x: x, y: y, pictureBox, functionName: FUNC_NAME);

View File

@ -56,7 +56,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
luaPictureBox = new LuaPictureBox luaPictureBox = new(_th)
{ {
Image = Properties.Resources.LuaPictureBox, Image = Properties.Resources.LuaPictureBox,
Location = new Point(0, 0), Location = new Point(0, 0),
@ -65,7 +65,6 @@ namespace BizHawk.Client.EmuHawk
Size = new Size(100, 50), Size = new Size(100, 50),
SizeMode = PictureBoxSizeMode.AutoSize, SizeMode = PictureBoxSizeMode.AutoSize,
TabIndex = 0, TabIndex = 0,
TableHelper = _th,
TabStop = false TabStop = false
}; };
Controls.Add(luaPictureBox); Controls.Add(luaPictureBox);

View File

@ -17,7 +17,7 @@ namespace BizHawk.Client.EmuHawk
private readonly Dictionary<Color, SolidBrush> _solidBrushes = new Dictionary<Color, SolidBrush>(); private readonly Dictionary<Color, SolidBrush> _solidBrushes = new Dictionary<Color, SolidBrush>();
private readonly Dictionary<Color, Pen> _pens = new Dictionary<Color, Pen>(); private readonly Dictionary<Color, Pen> _pens = new Dictionary<Color, Pen>();
internal NLuaTableHelper TableHelper { get; set; } private readonly NLuaTableHelper TableHelper;
private SolidBrush GetBrush([LuaColorParam] object color) private SolidBrush GetBrush([LuaColorParam] object color)
=> _solidBrushes.GetValueOrPutNew1(TableHelper.ParseColor(color)); => _solidBrushes.GetValueOrPutNew1(TableHelper.ParseColor(color));
@ -29,9 +29,10 @@ namespace BizHawk.Client.EmuHawk
private Color? _defaultBackground; private Color? _defaultBackground;
private Color? _defaultTextBackground = Color.FromArgb(128, 0, 0, 0); private Color? _defaultTextBackground = Color.FromArgb(128, 0, 0, 0);
public LuaPictureBox() public LuaPictureBox(NLuaTableHelper tableHelper)
{ {
Image = new Bitmap(Width, Height); Image = new Bitmap(Width, Height);
TableHelper = tableHelper;
} }
public void LuaResize(int width, int height) public void LuaResize(int width, int height)