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 | |
parent | 0191a758903099bdd39dddb2ef456333eee04fe3 (diff) |
Added box drawing and zoom.
Diffstat (limited to 'Native')
-rw-r--r-- | Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo | bin | 49152 -> 50176 bytes | |||
-rw-r--r-- | Native/EmuKeyboardDesigner/ImageControl.Designer.cs | 22 | ||||
-rw-r--r-- | Native/EmuKeyboardDesigner/ImageControl.cs | 30 | ||||
-rw-r--r-- | Native/EmuKeyboardDesigner/MainForm.Designer.cs | 24 |
4 files changed, 63 insertions, 13 deletions
diff --git a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo Binary files differindex 5dcb993..0619df7 100644 --- a/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo +++ b/Native/EmuKeyboardDesigner/EmuKeyboardDesigner.suo diff --git a/Native/EmuKeyboardDesigner/ImageControl.Designer.cs b/Native/EmuKeyboardDesigner/ImageControl.Designer.cs index b181eb3..f829d1f 100644 --- a/Native/EmuKeyboardDesigner/ImageControl.Designer.cs +++ b/Native/EmuKeyboardDesigner/ImageControl.Designer.cs @@ -36,11 +36,13 @@ this.label2 = new System.Windows.Forms.Label();
this.imageBox = new System.Windows.Forms.PictureBox();
this.loadButton = new System.Windows.Forms.Button();
+ this.zoom = new System.Windows.Forms.TrackBar();
((System.ComponentModel.ISupportInitialize)(this.xUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.yUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.heightUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.widthUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.zoom)).BeginInit();
this.SuspendLayout();
//
// label1
@@ -128,7 +130,7 @@ | System.Windows.Forms.AnchorStyles.Right)));
this.imageBox.Location = new System.Drawing.Point(0, 0);
this.imageBox.Name = "imageBox";
- this.imageBox.Size = new System.Drawing.Size(416, 212);
+ this.imageBox.Size = new System.Drawing.Size(388, 212);
this.imageBox.TabIndex = 6;
this.imageBox.TabStop = false;
//
@@ -143,10 +145,26 @@ this.loadButton.UseVisualStyleBackColor = true;
this.loadButton.Click += new System.EventHandler(this.OnLoad);
//
+ // zoom
+ //
+ this.zoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.zoom.AutoSize = false;
+ this.zoom.LargeChange = 1;
+ this.zoom.Location = new System.Drawing.Point(386, 104);
+ this.zoom.Maximum = 4;
+ this.zoom.Minimum = 1;
+ this.zoom.Name = "zoom";
+ this.zoom.Orientation = System.Windows.Forms.Orientation.Vertical;
+ this.zoom.Size = new System.Drawing.Size(31, 108);
+ this.zoom.TabIndex = 8;
+ this.zoom.Value = 1;
+ this.zoom.ValueChanged += new System.EventHandler(this.OnZoomChanged);
+ //
// ImageControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.zoom);
this.Controls.Add(this.loadButton);
this.Controls.Add(this.imageBox);
this.Controls.Add(this.heightUpDown);
@@ -163,6 +181,7 @@ ((System.ComponentModel.ISupportInitialize)(this.heightUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.widthUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.zoom)).EndInit();
this.ResumeLayout(false);
}
@@ -177,5 +196,6 @@ private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox imageBox;
private System.Windows.Forms.Button loadButton;
+ private System.Windows.Forms.TrackBar zoom;
}
}
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();
+ }
}
}
diff --git a/Native/EmuKeyboardDesigner/MainForm.Designer.cs b/Native/EmuKeyboardDesigner/MainForm.Designer.cs index a43a21d..44e2b6a 100644 --- a/Native/EmuKeyboardDesigner/MainForm.Designer.cs +++ b/Native/EmuKeyboardDesigner/MainForm.Designer.cs @@ -53,8 +53,8 @@ namespace EmuKeyboardDesigner this.loadButton = new System.Windows.Forms.Button();
this.saveButton = new System.Windows.Forms.Button();
this.setButton = new System.Windows.Forms.Button();
- this.imageControl = new EmuKeyboardDesigner.ImageControl();
this.removeButton = new System.Windows.Forms.Button();
+ this.imageControl = new EmuKeyboardDesigner.ImageControl();
this.SuspendLayout();
//
// keyList
@@ -107,6 +107,7 @@ namespace EmuKeyboardDesigner //
// loadButton
//
+ this.loadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.loadButton.Location = new System.Drawing.Point(501, 434);
this.loadButton.Name = "loadButton";
this.loadButton.Size = new System.Drawing.Size(75, 23);
@@ -117,6 +118,7 @@ namespace EmuKeyboardDesigner //
// saveButton
//
+ this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.saveButton.Location = new System.Drawing.Point(605, 434);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(75, 23);
@@ -135,6 +137,16 @@ namespace EmuKeyboardDesigner this.setButton.UseVisualStyleBackColor = true;
this.setButton.Click += new System.EventHandler(this.OnSetKey);
//
+ // removeButton
+ //
+ this.removeButton.Location = new System.Drawing.Point(322, 9);
+ this.removeButton.Name = "removeButton";
+ this.removeButton.Size = new System.Drawing.Size(78, 23);
+ this.removeButton.TabIndex = 9;
+ this.removeButton.Text = "Remove Key";
+ this.removeButton.UseVisualStyleBackColor = true;
+ this.removeButton.Click += new System.EventHandler(this.OnRemoveKey);
+ //
// imageControl
//
this.imageControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -151,16 +163,6 @@ namespace EmuKeyboardDesigner this.imageControl.Size = new System.Drawing.Size(482, 423);
this.imageControl.TabIndex = 5;
//
- // removeButton
- //
- this.removeButton.Location = new System.Drawing.Point(322, 9);
- this.removeButton.Name = "removeButton";
- this.removeButton.Size = new System.Drawing.Size(78, 23);
- this.removeButton.TabIndex = 9;
- this.removeButton.Text = "Remove Key";
- this.removeButton.UseVisualStyleBackColor = true;
- this.removeButton.Click += new System.EventHandler(this.OnRemoveKey);
- //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|