Fixed behavior of FocusedTextBox (special characters and bell).

This commit is contained in:
Lorenz Cuno Klopfenstein 2010-05-26 20:31:03 +02:00
parent b459475cf0
commit d389573363
5 changed files with 308 additions and 269 deletions

View file

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OnTopReplica {
static class EnumerationExtensions {
public static bool Contains<T>(IEnumerable<T> collection, T value){
foreach (var v in collection)
if (v.Equals(value))
return true;
return false;
}
}
}

View file

@ -19,18 +19,48 @@ namespace OnTopReplica {
if (e.KeyCode == Keys.Return) { if (e.KeyCode == Keys.Return) {
OnConfirmInput(); OnConfirmInput();
e.Handled = true; e.Handled = true;
e.SuppressKeyPress = true;
} }
else if (e.KeyCode == Keys.Escape) {
OnAbortInput();
e.Handled = true;
e.SuppressKeyPress = true;
}
base.OnKeyUp(e); Console.WriteLine("{0} ({1})", e.KeyCode, e.KeyValue);
base.OnKeyUp(e);
} }
//List of characters to ignore on KeyPress events (because they generate bell rings)
char[] _ignoreChars = new char[] {
(char)27, (char)13
};
protected override void OnKeyPress(KeyPressEventArgs e) {
if (EnumerationExtensions.Contains(_ignoreChars, e.KeyChar)) {
e.Handled = true;
}
base.OnKeyPress(e);
}
public event EventHandler ConfirmInput; public event EventHandler ConfirmInput;
protected virtual void OnConfirmInput() { protected virtual void OnConfirmInput() {
if (ConfirmInput != null) var evt = ConfirmInput;
ConfirmInput(this, EventArgs.Empty); if (evt != null)
evt(this, EventArgs.Empty);
} }
public event EventHandler AbortInput;
protected virtual void OnAbortInput() {
var evt = AbortInput;
if (evt != null)
evt(this, EventArgs.Empty);
}
} }
} }

View file

@ -105,6 +105,7 @@
</Compile> </Compile>
<Compile Include="CloneClickEventArgs.cs" /> <Compile Include="CloneClickEventArgs.cs" />
<Compile Include="CloseRequestEventArgs.cs" /> <Compile Include="CloseRequestEventArgs.cs" />
<Compile Include="EnumerationExtensions.cs" />
<Compile Include="FullscreenMode.cs" /> <Compile Include="FullscreenMode.cs" />
<Compile Include="Strings.it.Designer.cs"> <Compile Include="Strings.it.Designer.cs">
<DependentUpon>Strings.it.resx</DependentUpon> <DependentUpon>Strings.it.resx</DependentUpon>

View file

@ -23,302 +23,284 @@
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() { private void InitializeComponent() {
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.numH = new System.Windows.Forms.NumericUpDown(); this.numH = new System.Windows.Forms.NumericUpDown();
this.numW = new System.Windows.Forms.NumericUpDown(); this.numW = new System.Windows.Forms.NumericUpDown();
this.numY = new System.Windows.Forms.NumericUpDown(); this.numY = new System.Windows.Forms.NumericUpDown();
this.numX = new System.Windows.Forms.NumericUpDown(); this.numX = new System.Windows.Forms.NumericUpDown();
this.buttonDone = new System.Windows.Forms.Button(); this.buttonDone = new System.Windows.Forms.Button();
this.buttonReset = new System.Windows.Forms.Button(); this.buttonReset = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.buttonDelete = new System.Windows.Forms.Button(); this.buttonDelete = new System.Windows.Forms.Button();
this.buttonSave = new System.Windows.Forms.Button(); this.buttonSave = new System.Windows.Forms.Button();
this.comboBox1 = new VistaControls.ComboBox(); this.comboBox1 = new VistaControls.ComboBox();
this.textRegionName = new OnTopReplica.FocusedTextBox(); this.textRegionName = new OnTopReplica.FocusedTextBox();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numH)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numH)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numW)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numW)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numY)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numY)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numX)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numX)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// panel1 // panel1
// //
this.panel1.BackColor = System.Drawing.SystemColors.Control; this.panel1.BackColor = System.Drawing.SystemColors.Control;
this.panel1.Controls.Add(this.groupBox1); this.panel1.Controls.Add(this.groupBox1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel1.Name = "panel1";
this.panel1.Name = "panel1"; this.panel1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.panel1.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5); this.panel1.Size = new System.Drawing.Size(175, 237);
this.panel1.Size = new System.Drawing.Size(233, 292); this.panel1.TabIndex = 0;
this.panel1.TabIndex = 0; //
// // groupBox1
// groupBox1 //
// this.groupBox1.Controls.Add(this.textRegionName);
this.groupBox1.Controls.Add(this.textRegionName); this.groupBox1.Controls.Add(this.numH);
this.groupBox1.Controls.Add(this.numH); this.groupBox1.Controls.Add(this.numW);
this.groupBox1.Controls.Add(this.numW); this.groupBox1.Controls.Add(this.numY);
this.groupBox1.Controls.Add(this.numY); this.groupBox1.Controls.Add(this.numX);
this.groupBox1.Controls.Add(this.numX); this.groupBox1.Controls.Add(this.buttonDone);
this.groupBox1.Controls.Add(this.buttonDone); this.groupBox1.Controls.Add(this.buttonReset);
this.groupBox1.Controls.Add(this.buttonReset); this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label6); this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label7); this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.buttonDelete);
this.groupBox1.Controls.Add(this.buttonDelete); this.groupBox1.Controls.Add(this.buttonSave);
this.groupBox1.Controls.Add(this.buttonSave); this.groupBox1.Controls.Add(this.comboBox1);
this.groupBox1.Controls.Add(this.comboBox1); this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Location = new System.Drawing.Point(4, 4);
this.groupBox1.Location = new System.Drawing.Point(5, 5); this.groupBox1.Name = "groupBox1";
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBox1.Size = new System.Drawing.Size(167, 229);
this.groupBox1.Name = "groupBox1"; this.groupBox1.TabIndex = 0;
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBox1.TabStop = false;
this.groupBox1.Size = new System.Drawing.Size(223, 282); this.groupBox1.Text = "Regions";
this.groupBox1.TabIndex = 0; //
this.groupBox1.TabStop = false; // numH
this.groupBox1.Text = Strings.RegionsTitle; //
// this.numH.Enabled = false;
// numH this.numH.Location = new System.Drawing.Point(109, 122);
// this.numH.Maximum = new decimal(new int[] {
this.numH.Enabled = false;
this.numH.Location = new System.Drawing.Point(145, 150);
this.numH.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.numH.Maximum = new decimal(new int[] {
100000, 100000,
0, 0,
0, 0,
0}); 0});
this.numH.Minimum = new decimal(new int[] { this.numH.Minimum = new decimal(new int[] {
100000, 100000,
0, 0,
0, 0,
-2147483648}); -2147483648});
this.numH.Name = "numH"; this.numH.Name = "numH";
this.numH.Size = new System.Drawing.Size(57, 22); this.numH.Size = new System.Drawing.Size(43, 20);
this.numH.TabIndex = 7; this.numH.TabIndex = 7;
this.numH.ValueChanged += new System.EventHandler(this.RegionValueChanged); this.numH.ValueChanged += new System.EventHandler(this.RegionValueChanged);
// //
// numW // numW
// //
this.numW.Enabled = false; this.numW.Enabled = false;
this.numW.Location = new System.Drawing.Point(145, 118); this.numW.Location = new System.Drawing.Point(109, 96);
this.numW.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.numW.Maximum = new decimal(new int[] {
this.numW.Maximum = new decimal(new int[] {
100000, 100000,
0, 0,
0, 0,
0}); 0});
this.numW.Minimum = new decimal(new int[] { this.numW.Minimum = new decimal(new int[] {
100000, 100000,
0, 0,
0, 0,
-2147483648}); -2147483648});
this.numW.Name = "numW"; this.numW.Name = "numW";
this.numW.Size = new System.Drawing.Size(57, 22); this.numW.Size = new System.Drawing.Size(43, 20);
this.numW.TabIndex = 6; this.numW.TabIndex = 6;
this.numW.ValueChanged += new System.EventHandler(this.RegionValueChanged); this.numW.ValueChanged += new System.EventHandler(this.RegionValueChanged);
// //
// numY // numY
// //
this.numY.Enabled = false; this.numY.Enabled = false;
this.numY.Location = new System.Drawing.Point(31, 150); this.numY.Location = new System.Drawing.Point(23, 122);
this.numY.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.numY.Maximum = new decimal(new int[] {
this.numY.Maximum = new decimal(new int[] {
100000, 100000,
0, 0,
0, 0,
0}); 0});
this.numY.Minimum = new decimal(new int[] { this.numY.Minimum = new decimal(new int[] {
100000, 100000,
0, 0,
0, 0,
-2147483648}); -2147483648});
this.numY.Name = "numY"; this.numY.Name = "numY";
this.numY.Size = new System.Drawing.Size(57, 22); this.numY.Size = new System.Drawing.Size(43, 20);
this.numY.TabIndex = 5; this.numY.TabIndex = 5;
this.numY.ValueChanged += new System.EventHandler(this.RegionValueChanged); this.numY.ValueChanged += new System.EventHandler(this.RegionValueChanged);
// //
// numX // numX
// //
this.numX.Enabled = false; this.numX.Enabled = false;
this.numX.Location = new System.Drawing.Point(31, 118); this.numX.Location = new System.Drawing.Point(23, 96);
this.numX.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.numX.Maximum = new decimal(new int[] {
this.numX.Maximum = new decimal(new int[] {
100000, 100000,
0, 0,
0, 0,
0}); 0});
this.numX.Minimum = new decimal(new int[] { this.numX.Minimum = new decimal(new int[] {
100000, 100000,
0, 0,
0, 0,
-2147483648}); -2147483648});
this.numX.Name = "numX"; this.numX.Name = "numX";
this.numX.Size = new System.Drawing.Size(57, 22); this.numX.Size = new System.Drawing.Size(43, 20);
this.numX.TabIndex = 4; this.numX.TabIndex = 4;
this.numX.ValueChanged += new System.EventHandler(this.RegionValueChanged); this.numX.ValueChanged += new System.EventHandler(this.RegionValueChanged);
// //
// buttonDone // buttonDone
// //
this.buttonDone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonDone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDone.Location = new System.Drawing.Point(135, 246); this.buttonDone.Location = new System.Drawing.Point(101, 200);
this.buttonDone.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.buttonDone.Name = "buttonDone";
this.buttonDone.Name = "buttonDone"; this.buttonDone.Size = new System.Drawing.Size(60, 23);
this.buttonDone.Size = new System.Drawing.Size(80, 28); this.buttonDone.TabIndex = 9;
this.buttonDone.TabIndex = 9; this.buttonDone.Text = global::OnTopReplica.Strings.RegionsDoneButton;
this.buttonDone.Text = global::OnTopReplica.Strings.RegionsDoneButton; this.buttonDone.UseVisualStyleBackColor = true;
this.buttonDone.UseVisualStyleBackColor = true; this.buttonDone.Click += new System.EventHandler(this.CloseClick);
this.buttonDone.Click += new System.EventHandler(this.CloseClick); //
// // buttonReset
// buttonReset //
// this.buttonReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonReset.Location = new System.Drawing.Point(6, 200);
this.buttonReset.Location = new System.Drawing.Point(8, 246); this.buttonReset.Name = "buttonReset";
this.buttonReset.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.buttonReset.Size = new System.Drawing.Size(60, 23);
this.buttonReset.Name = "buttonReset"; this.buttonReset.TabIndex = 8;
this.buttonReset.Size = new System.Drawing.Size(80, 28); this.buttonReset.Text = global::OnTopReplica.Strings.RegionsResetButton;
this.buttonReset.TabIndex = 8; this.buttonReset.UseVisualStyleBackColor = true;
this.buttonReset.Text = global::OnTopReplica.Strings.RegionsResetButton; this.buttonReset.Click += new System.EventHandler(this.ResetClick);
this.buttonReset.UseVisualStyleBackColor = true; //
this.buttonReset.Click += new System.EventHandler(this.ResetClick); // label6
// //
// label6 this.label6.AutoSize = true;
// this.label6.ForeColor = System.Drawing.SystemColors.ControlDark;
this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(71, 124);
this.label6.ForeColor = System.Drawing.SystemColors.ControlDark; this.label6.Name = "label6";
this.label6.Location = new System.Drawing.Point(95, 153); this.label6.Size = new System.Drawing.Size(38, 13);
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label6.TabIndex = 9;
this.label6.Name = "label6"; this.label6.Text = "Height";
this.label6.Size = new System.Drawing.Size(49, 17); //
this.label6.TabIndex = 9; // label7
this.label6.Text = Strings.RegionsHeight; //
// this.label7.AutoSize = true;
// label7 this.label7.ForeColor = System.Drawing.SystemColors.ControlDark;
// this.label7.Location = new System.Drawing.Point(71, 98);
this.label7.AutoSize = true; this.label7.Name = "label7";
this.label7.ForeColor = System.Drawing.SystemColors.ControlDark; this.label7.Size = new System.Drawing.Size(35, 13);
this.label7.Location = new System.Drawing.Point(95, 121); this.label7.TabIndex = 8;
this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label7.Text = "Width";
this.label7.Name = "label7"; //
this.label7.Size = new System.Drawing.Size(44, 17); // label3
this.label7.TabIndex = 8; //
this.label7.Text = Strings.RegionsWidth; this.label3.AutoSize = true;
// this.label3.ForeColor = System.Drawing.SystemColors.ControlDark;
// label3 this.label3.Location = new System.Drawing.Point(6, 124);
// this.label3.Name = "label3";
this.label3.AutoSize = true; this.label3.Size = new System.Drawing.Size(14, 13);
this.label3.ForeColor = System.Drawing.SystemColors.ControlDark; this.label3.TabIndex = 5;
this.label3.Location = new System.Drawing.Point(8, 153); this.label3.Text = "Y";
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); //
this.label3.Name = "label3"; // label2
this.label3.Size = new System.Drawing.Size(17, 17); //
this.label3.TabIndex = 5; this.label2.AutoSize = true;
this.label3.Text = "Y"; this.label2.ForeColor = System.Drawing.SystemColors.ControlDark;
// this.label2.Location = new System.Drawing.Point(6, 98);
// label2 this.label2.Name = "label2";
// this.label2.Size = new System.Drawing.Size(14, 13);
this.label2.AutoSize = true; this.label2.TabIndex = 4;
this.label2.ForeColor = System.Drawing.SystemColors.ControlDark; this.label2.Text = "X";
this.label2.Location = new System.Drawing.Point(8, 121); //
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); // label1
this.label2.Name = "label2"; //
this.label2.Size = new System.Drawing.Size(17, 17); this.label1.AutoSize = true;
this.label2.TabIndex = 4; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Text = "X"; this.label1.Location = new System.Drawing.Point(6, 76);
// this.label1.Name = "label1";
// label1 this.label1.Size = new System.Drawing.Size(76, 13);
// this.label1.TabIndex = 3;
this.label1.AutoSize = true; this.label1.Text = "Current region:";
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); //
this.label1.Location = new System.Drawing.Point(8, 94); // buttonDelete
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); //
this.label1.Name = "label1"; this.buttonDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.Size = new System.Drawing.Size(103, 17); this.buttonDelete.Enabled = false;
this.label1.TabIndex = 3; this.buttonDelete.Location = new System.Drawing.Point(101, 46);
this.label1.Text = Strings.RegionsCurrentRegion; this.buttonDelete.Name = "buttonDelete";
// this.buttonDelete.Size = new System.Drawing.Size(60, 23);
// buttonDelete this.buttonDelete.TabIndex = 3;
// this.buttonDelete.Text = global::OnTopReplica.Strings.RegionsDeleteButton;
this.buttonDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.buttonDelete.UseVisualStyleBackColor = true;
this.buttonDelete.Enabled = false; this.buttonDelete.Click += new System.EventHandler(this.DeleteClick);
this.buttonDelete.Location = new System.Drawing.Point(135, 57); //
this.buttonDelete.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); // buttonSave
this.buttonDelete.Name = "buttonDelete"; //
this.buttonDelete.Size = new System.Drawing.Size(80, 28); this.buttonSave.Enabled = false;
this.buttonDelete.TabIndex = 3; this.buttonSave.Location = new System.Drawing.Point(6, 46);
this.buttonDelete.Text = global::OnTopReplica.Strings.RegionsDeleteButton; this.buttonSave.Name = "buttonSave";
this.buttonDelete.UseVisualStyleBackColor = true; this.buttonSave.Size = new System.Drawing.Size(60, 23);
this.buttonDelete.Click += new System.EventHandler(this.DeleteClick); this.buttonSave.TabIndex = 1;
// this.buttonSave.Text = global::OnTopReplica.Strings.RegionsSaveButton;
// buttonSave this.buttonSave.UseVisualStyleBackColor = true;
// this.buttonSave.Click += new System.EventHandler(this.SaveClick);
this.buttonSave.Enabled = false; //
this.buttonSave.Location = new System.Drawing.Point(8, 57); // comboBox1
this.buttonSave.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); //
this.buttonSave.Name = "buttonSave"; this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.buttonSave.Size = new System.Drawing.Size(80, 28); | System.Windows.Forms.AnchorStyles.Right)));
this.buttonSave.TabIndex = 1; this.comboBox1.CueBannerText = global::OnTopReplica.Strings.RegionsStoredRegions;
this.buttonSave.Text = global::OnTopReplica.Strings.RegionsSaveButton; this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.buttonSave.UseVisualStyleBackColor = true; this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonSave.Click += new System.EventHandler(this.SaveClick); this.comboBox1.FormattingEnabled = true;
// this.comboBox1.Location = new System.Drawing.Point(6, 19);
// comboBox1 this.comboBox1.Name = "comboBox1";
// this.comboBox1.Size = new System.Drawing.Size(156, 21);
this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.comboBox1.TabIndex = 0;
| System.Windows.Forms.AnchorStyles.Right))); this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.RegionCombo_index);
this.comboBox1.CueBannerText = global::OnTopReplica.Strings.RegionsStoredRegions; //
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; // textRegionName
this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.System; //
this.comboBox1.FormattingEnabled = true; this.textRegionName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.comboBox1.Location = new System.Drawing.Point(8, 23); | System.Windows.Forms.AnchorStyles.Right)));
this.comboBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.textRegionName.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.comboBox1.Name = "comboBox1"; this.textRegionName.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.comboBox1.Size = new System.Drawing.Size(206, 24); this.textRegionName.Location = new System.Drawing.Point(6, 48);
this.comboBox1.TabIndex = 0; this.textRegionName.Name = "textRegionName";
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.RegionCombo_index); this.textRegionName.Size = new System.Drawing.Size(90, 20);
// this.textRegionName.TabIndex = 2;
// textRegionName this.textRegionName.Visible = false;
// this.textRegionName.ConfirmInput += new System.EventHandler(this.Save_confirm);
this.textRegionName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.textRegionName.AbortInput += new System.EventHandler(this.Save_lost);
| System.Windows.Forms.AnchorStyles.Right))); this.textRegionName.Leave += new System.EventHandler(this.Save_lost);
this.textRegionName.BackColor = System.Drawing.SystemColors.ActiveCaption; //
this.textRegionName.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; // RegionBox
this.textRegionName.Location = new System.Drawing.Point(8, 59); //
this.textRegionName.Margin = new System.Windows.Forms.Padding(4); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.textRegionName.Name = "textRegionName"; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.textRegionName.Size = new System.Drawing.Size(118, 22); this.BackColor = System.Drawing.Color.Black;
this.textRegionName.TabIndex = 2; this.Controls.Add(this.panel1);
this.textRegionName.Visible = false; this.MinimumSize = new System.Drawing.Size(160, 180);
this.textRegionName.Leave += new System.EventHandler(this.Save_lost); this.Name = "RegionBox";
this.textRegionName.ConfirmInput += new System.EventHandler(this.Save_confirm); this.Size = new System.Drawing.Size(175, 237);
// this.panel1.ResumeLayout(false);
// RegionBox this.groupBox1.ResumeLayout(false);
// this.groupBox1.PerformLayout();
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); ((System.ComponentModel.ISupportInitialize)(this.numH)).EndInit();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; ((System.ComponentModel.ISupportInitialize)(this.numW)).EndInit();
this.BackColor = System.Drawing.Color.Black; ((System.ComponentModel.ISupportInitialize)(this.numY)).EndInit();
this.Controls.Add(this.panel1); ((System.ComponentModel.ISupportInitialize)(this.numX)).EndInit();
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ResumeLayout(false);
this.MinimumSize = new System.Drawing.Size(213, 222);
this.Name = "RegionBox";
this.Size = new System.Drawing.Size(233, 292);
this.panel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numH)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numW)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numY)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numX)).EndInit();
this.ResumeLayout(false);
} }

View file

@ -104,8 +104,15 @@ namespace OnTopReplica {
} }
private void DeleteClick(object sender, EventArgs e) { private void DeleteClick(object sender, EventArgs e) {
Settings.Default.SavedRegions.RemoveAt(comboBox1.SelectedIndex); if (comboBox1.SelectedIndex < 0)
comboBox1.Items.RemoveAt(comboBox1.SelectedIndex); return;
var origIndex = comboBox1.SelectedIndex;
Settings.Default.SavedRegions.RemoveAt(origIndex);
comboBox1.Items.RemoveAt(origIndex);
if (comboBox1.Items.Count > 0)
comboBox1.SelectedIndex = 0;
} }
private void SaveClick(object sender, EventArgs e) { private void SaveClick(object sender, EventArgs e) {