Skip to content

Commit b51bb85

Browse files
committed
Replace LuaPictureBox prop init with constructor
1 parent e5e055b commit b51bb85

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/FormsLuaLibrary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public long PictureBox(long formHandle, int? x = null, int? y = null, int? width
305305
return 0;
306306
}
307307

308-
var pictureBox = new LuaPictureBox { TableHelper = _th };
308+
LuaPictureBox pictureBox = new(_th);
309309
form.Controls.Add(pictureBox);
310310
const string FUNC_NAME = "forms.pictureBox";
311311
ProcessPositionArguments(x: x, y: y, pictureBox, functionName: FUNC_NAME);

src/BizHawk.Client.EmuHawk/tools/Lua/LuaCanvas.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public LuaCanvas(
5656
}
5757
}
5858

59-
luaPictureBox = new LuaPictureBox
59+
luaPictureBox = new(_th)
6060
{
6161
Image = Properties.Resources.LuaPictureBox,
6262
Location = new Point(0, 0),
@@ -65,7 +65,6 @@ public LuaCanvas(
6565
Size = new Size(100, 50),
6666
SizeMode = PictureBoxSizeMode.AutoSize,
6767
TabIndex = 0,
68-
TableHelper = _th,
6968
TabStop = false
7069
};
7170
Controls.Add(luaPictureBox);

src/BizHawk.Client.EmuHawk/tools/Lua/LuaPictureBox.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class LuaPictureBox : PictureBox
1717
private readonly Dictionary<Color, SolidBrush> _solidBrushes = new Dictionary<Color, SolidBrush>();
1818
private readonly Dictionary<Color, Pen> _pens = new Dictionary<Color, Pen>();
1919

20-
internal NLuaTableHelper TableHelper { get; set; }
20+
private readonly NLuaTableHelper TableHelper;
2121

2222
private SolidBrush GetBrush([LuaColorParam] object color)
2323
=> _solidBrushes.GetValueOrPutNew1(TableHelper.ParseColor(color));
@@ -29,9 +29,10 @@ private Pen GetPen([LuaColorParam] object color)
2929
private Color? _defaultBackground;
3030
private Color? _defaultTextBackground = Color.FromArgb(128, 0, 0, 0);
3131

32-
public LuaPictureBox()
32+
public LuaPictureBox(NLuaTableHelper tableHelper)
3333
{
3434
Image = new Bitmap(Width, Height);
35+
TableHelper = tableHelper;
3536
}
3637

3738
public void LuaResize(int width, int height)

0 commit comments

Comments
 (0)