summaryrefslogtreecommitdiff
path: root/Native/EmuKeyboardDesigner/ImageControl.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Native/EmuKeyboardDesigner/ImageControl.cs')
-rw-r--r--Native/EmuKeyboardDesigner/ImageControl.cs30
1 files changed, 29 insertions, 1 deletions
diff --git a/Native/EmuKeyboardDesigner/ImageControl.cs b/Native/EmuKeyboardDesigner/ImageControl.cs
index 06e4c74..02b37cd 100644
--- a/Native/EmuKeyboardDesigner/ImageControl.cs
+++ b/Native/EmuKeyboardDesigner/ImageControl.cs
@@ -44,6 +44,7 @@ namespace EmuKeyboardDesigner
set
{
xUpDown.Value = value;
+ UpdateKeyOverlay();
}
}
@@ -56,6 +57,7 @@ namespace EmuKeyboardDesigner
set
{
yUpDown.Value = value;
+ UpdateKeyOverlay();
}
}
@@ -68,6 +70,7 @@ namespace EmuKeyboardDesigner
set
{
widthUpDown.Value = value;
+ UpdateKeyOverlay();
}
}
@@ -80,6 +83,7 @@ namespace EmuKeyboardDesigner
set
{
heightUpDown.Value = value;
+ UpdateKeyOverlay();
}
}
@@ -87,6 +91,25 @@ namespace EmuKeyboardDesigner
{
if (image != null)
{
+ Bitmap bmp = new Bitmap(image, image.Width * zoom.Value, image.Height * zoom.Value);
+
+ using (Graphics g = Graphics.FromImage(bmp))
+ {
+ using (Pen p = new Pen(Color.White, zoom.Value))
+ {
+ g.DrawRectangle(p, (int)xUpDown.Value * zoom.Value,
+ (int)yUpDown.Value * zoom.Value,
+ (int)widthUpDown.Value * zoom.Value,
+ (int)heightUpDown.Value * zoom.Value);
+ }
+ }
+
+ if (imageBox.Image != null)
+ {
+ imageBox.Image.Dispose();
+ }
+
+ imageBox.Image = bmp;
}
}
@@ -124,7 +147,7 @@ namespace EmuKeyboardDesigner
try
{
image = (Bitmap)Image.FromFile(fsel.FileName);
- imageBox.Image = image;
+ UpdateKeyOverlay();
}
catch (Exception ex)
{
@@ -134,5 +157,10 @@ namespace EmuKeyboardDesigner
UpdateKeyOverlay();
}
+
+ private void OnZoomChanged(object sender, EventArgs e)
+ {
+ UpdateKeyOverlay();
+ }
}
}