diff options
author | Ian C <ianc@noddybox.co.uk> | 2012-04-28 23:13:45 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2012-04-28 23:13:45 +0000 |
commit | 6b9f0d6bd993eed988a643918103099d8d021327 (patch) | |
tree | 7d66f678dd38c6b9e4bc4cb2d449f97148929047 /Native/EmuKeyboardDesigner/ImageControl.cs | |
parent | 0191a758903099bdd39dddb2ef456333eee04fe3 (diff) |
Added box drawing and zoom.
Diffstat (limited to 'Native/EmuKeyboardDesigner/ImageControl.cs')
-rw-r--r-- | Native/EmuKeyboardDesigner/ImageControl.cs | 30 |
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();
+ }
}
}
|