diff --git a/BaseConverter/Form1.Designer.cs b/BaseConverter/Form1.Designer.cs index be95f42..85cb968 100644 --- a/BaseConverter/Form1.Designer.cs +++ b/BaseConverter/Form1.Designer.cs @@ -46,6 +46,7 @@ namespace WindowsFormsApplication1 /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.computeButton = new System.Windows.Forms.Button(); this.clearButton = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); @@ -62,6 +63,8 @@ namespace WindowsFormsApplication1 this.binaryRadioButton = new System.Windows.Forms.RadioButton(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.octalTextBox = new System.Windows.Forms.TextBox(); + this.autoCompute = new System.Windows.Forms.CheckBox(); + this.autoComputeToolTip = new System.Windows.Forms.ToolTip(this.components); this.groupBox1.SuspendLayout(); this.binaryGroupBox.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -71,7 +74,7 @@ namespace WindowsFormsApplication1 // // computeButton // - this.computeButton.Location = new System.Drawing.Point(12, 319); + this.computeButton.Location = new System.Drawing.Point(12, 329); this.computeButton.Name = "computeButton"; this.computeButton.Size = new System.Drawing.Size(91, 23); this.computeButton.TabIndex = 5; @@ -81,7 +84,7 @@ namespace WindowsFormsApplication1 // // clearButton // - this.clearButton.Location = new System.Drawing.Point(109, 319); + this.clearButton.Location = new System.Drawing.Point(109, 329); this.clearButton.Name = "clearButton"; this.clearButton.Size = new System.Drawing.Size(85, 23); this.clearButton.TabIndex = 6; @@ -92,7 +95,7 @@ namespace WindowsFormsApplication1 // groupBox1 // this.groupBox1.Controls.Add(this.hexTextBox); - this.groupBox1.Location = new System.Drawing.Point(12, 72); + this.groupBox1.Location = new System.Drawing.Point(10, 72); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(279, 54); this.groupBox1.TabIndex = 1; @@ -107,11 +110,12 @@ namespace WindowsFormsApplication1 this.hexTextBox.Size = new System.Drawing.Size(261, 20); this.hexTextBox.TabIndex = 0; this.hexTextBox.Text = "0"; + this.hexTextBox.TextChanged += new System.EventHandler(this.hexTextBox_TextChanged); // // binaryGroupBox // this.binaryGroupBox.Controls.Add(this.binaryTextBox); - this.binaryGroupBox.Location = new System.Drawing.Point(12, 12); + this.binaryGroupBox.Location = new System.Drawing.Point(9, 12); this.binaryGroupBox.Name = "binaryGroupBox"; this.binaryGroupBox.Size = new System.Drawing.Size(279, 54); this.binaryGroupBox.TabIndex = 0; @@ -126,11 +130,12 @@ namespace WindowsFormsApplication1 this.binaryTextBox.Size = new System.Drawing.Size(261, 20); this.binaryTextBox.TabIndex = 0; this.binaryTextBox.Text = "0"; + this.binaryTextBox.TextChanged += new System.EventHandler(this.binaryTextBox_TextChanged); // // groupBox2 // this.groupBox2.Controls.Add(this.decimalTextBox); - this.groupBox2.Location = new System.Drawing.Point(12, 192); + this.groupBox2.Location = new System.Drawing.Point(10, 192); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(279, 54); this.groupBox2.TabIndex = 3; @@ -145,10 +150,11 @@ namespace WindowsFormsApplication1 this.decimalTextBox.Size = new System.Drawing.Size(261, 20); this.decimalTextBox.TabIndex = 0; this.decimalTextBox.Text = "0"; + this.decimalTextBox.TextChanged += new System.EventHandler(this.decimalTextBox_TextChanged); // // exitButton // - this.exitButton.Location = new System.Drawing.Point(200, 319); + this.exitButton.Location = new System.Drawing.Point(200, 329); this.exitButton.Name = "exitButton"; this.exitButton.Size = new System.Drawing.Size(91, 23); this.exitButton.TabIndex = 7; @@ -220,7 +226,7 @@ namespace WindowsFormsApplication1 // groupBox4 // this.groupBox4.Controls.Add(this.octalTextBox); - this.groupBox4.Location = new System.Drawing.Point(12, 132); + this.groupBox4.Location = new System.Drawing.Point(9, 132); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(279, 54); this.groupBox4.TabIndex = 2; @@ -235,12 +241,29 @@ namespace WindowsFormsApplication1 this.octalTextBox.Size = new System.Drawing.Size(261, 20); this.octalTextBox.TabIndex = 0; this.octalTextBox.Text = "0"; + this.octalTextBox.TextChanged += new System.EventHandler(this.octalTextBox_TextChanged); + // + // autoCompute + // + this.autoCompute.AutoSize = true; + this.autoCompute.Location = new System.Drawing.Point(16, 310); + this.autoCompute.Name = "autoCompute"; + this.autoCompute.Size = new System.Drawing.Size(138, 17); + this.autoCompute.TabIndex = 8; + this.autoCompute.Text = "Automatically compute?"; + this.autoCompute.UseVisualStyleBackColor = true; + // + // autoComputeToolTip + // + this.autoComputeToolTip.IsBalloon = true; + //this.autoComputeToolTip.Popup += new System.Windows.Forms.PopupEventHandler(this.autoComputeToolTip_Popup); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(300, 347); + this.ClientSize = new System.Drawing.Size(300, 364); + this.Controls.Add(this.autoCompute); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox3); this.Controls.Add(this.exitButton); @@ -262,6 +285,7 @@ namespace WindowsFormsApplication1 this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -283,6 +307,8 @@ namespace WindowsFormsApplication1 private System.Windows.Forms.RadioButton octalRadioButton; private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.TextBox octalTextBox; + private System.Windows.Forms.CheckBox autoCompute; + private System.Windows.Forms.ToolTip autoComputeToolTip; } } diff --git a/BaseConverter/Form1.cs b/BaseConverter/Form1.cs index a7bf6fa..eb8f1dd 100644 --- a/BaseConverter/Form1.cs +++ b/BaseConverter/Form1.cs @@ -32,40 +32,12 @@ namespace WindowsFormsApplication1 public Form1() { InitializeComponent(); + ToolTip toolTip = new ToolTip(); + toolTip.SetToolTip(autoCompute, "Automatically computes input based on changes made to textbox contents."); + } - - - private void currentFocus(string focusOn) { - switch (focusOn) - { - case "binaryTextBox": - binaryTextBox.Focus(); - break; - case "hexTextBox": - hexTextBox.Focus(); - break; - case "octalTextBox": - octalTextBox.Focus(); - break; - case "decimalTextBox": - decimalTextBox.Focus(); - break; - default: - this.Focus(); - break; - } - } - - private void clearTextboxes() - { - hexTextBox.Text = "0"; - binaryTextBox.Text = "0"; - octalTextBox.Text = "0"; - decimalTextBox.Text = "0"; - } - - private void computeButton_Click(object sender, EventArgs e) + private void compute() { // Define variables long decimalNum = 0, hexNum = 0, binNum = 0, octalNum = 0; @@ -93,7 +65,8 @@ namespace WindowsFormsApplication1 //Refocus the textbox when done. currentFocus("decimalTextBox"); } - if (octalRadioButton.Checked) { + if (octalRadioButton.Checked) + { // The octal radio button is pressed. hexNum = octalNum; binNum = octalNum; @@ -125,9 +98,39 @@ namespace WindowsFormsApplication1 hexTextBox.Text = hexNum.ToString("X"); binaryTextBox.Text = Convert.ToString(binNum, 2); octalTextBox.Text = Convert.ToString(octalNum, 8); + } + private void currentFocus(string focusOn) { + switch (focusOn) + { + case "binaryTextBox": + binaryTextBox.Focus(); + break; + case "hexTextBox": + hexTextBox.Focus(); + break; + case "octalTextBox": + octalTextBox.Focus(); + break; + case "decimalTextBox": + decimalTextBox.Focus(); + break; + default: + this.Focus(); + break; + } + } - - + private void clearTextboxes() + { + hexTextBox.Text = "0"; + binaryTextBox.Text = "0"; + octalTextBox.Text = "0"; + decimalTextBox.Text = "0"; + } + + private void computeButton_Click(object sender, EventArgs e) + { + compute(); } private void clearButton_Click(object sender, EventArgs e) @@ -170,5 +173,29 @@ namespace WindowsFormsApplication1 { currentFocus("octalTextBox"); } + + private void binaryTextBox_TextChanged(object sender, EventArgs e) + { + if (autoCompute.Checked) + compute(); + } + + private void hexTextBox_TextChanged(object sender, EventArgs e) + { + if (autoCompute.Checked) + compute(); + } + + private void octalTextBox_TextChanged(object sender, EventArgs e) + { + if (autoCompute.Checked) + compute(); + } + + private void decimalTextBox_TextChanged(object sender, EventArgs e) + { + if (autoCompute.Checked) + compute(); + } } } diff --git a/BaseConverter/Form1.resx b/BaseConverter/Form1.resx index 19dc0dd..d7f15e4 100644 --- a/BaseConverter/Form1.resx +++ b/BaseConverter/Form1.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/BaseConverter/bin/Debug/BaseConverter.application b/BaseConverter/bin/Debug/BaseConverter.application index a5285e8..29c0ddb 100644 --- a/BaseConverter/bin/Debug/BaseConverter.application +++ b/BaseConverter/bin/Debug/BaseConverter.application @@ -11,7 +11,7 @@ - cEX9hsGiiCx0dr+SNR+Qk8kAYHI= + yuucww+k7TDTPDj046KVMAquP4M= diff --git a/BaseConverter/bin/Debug/BaseConverter.exe b/BaseConverter/bin/Debug/BaseConverter.exe index 3912c7f..4660b30 100644 Binary files a/BaseConverter/bin/Debug/BaseConverter.exe and b/BaseConverter/bin/Debug/BaseConverter.exe differ diff --git a/BaseConverter/bin/Debug/BaseConverter.exe.manifest b/BaseConverter/bin/Debug/BaseConverter.exe.manifest index 17897ce..452eee4 100644 --- a/BaseConverter/bin/Debug/BaseConverter.exe.manifest +++ b/BaseConverter/bin/Debug/BaseConverter.exe.manifest @@ -52,14 +52,14 @@ - + - dZXLG29YzjAwtfDgkFQyhpdG14U= + AZ1RyIR6zUElaFiQPabdRc1KQGU= diff --git a/BaseConverter/bin/Debug/BaseConverter.pdb b/BaseConverter/bin/Debug/BaseConverter.pdb index 5ec71b6..f693ad7 100644 Binary files a/BaseConverter/bin/Debug/BaseConverter.pdb and b/BaseConverter/bin/Debug/BaseConverter.pdb differ diff --git a/BaseConverter/bin/Debug/BaseConverter.vshost.application b/BaseConverter/bin/Debug/BaseConverter.vshost.application index a5285e8..29c0ddb 100644 --- a/BaseConverter/bin/Debug/BaseConverter.vshost.application +++ b/BaseConverter/bin/Debug/BaseConverter.vshost.application @@ -11,7 +11,7 @@ - cEX9hsGiiCx0dr+SNR+Qk8kAYHI= + yuucww+k7TDTPDj046KVMAquP4M= diff --git a/BaseConverter/obj/Debug/BaseConverter.application b/BaseConverter/obj/Debug/BaseConverter.application index a5285e8..29c0ddb 100644 --- a/BaseConverter/obj/Debug/BaseConverter.application +++ b/BaseConverter/obj/Debug/BaseConverter.application @@ -11,7 +11,7 @@ - cEX9hsGiiCx0dr+SNR+Qk8kAYHI= + yuucww+k7TDTPDj046KVMAquP4M= diff --git a/BaseConverter/obj/Debug/BaseConverter.csproj.GenerateResource.Cache b/BaseConverter/obj/Debug/BaseConverter.csproj.GenerateResource.Cache index 35a65f5..86fa837 100644 Binary files a/BaseConverter/obj/Debug/BaseConverter.csproj.GenerateResource.Cache and b/BaseConverter/obj/Debug/BaseConverter.csproj.GenerateResource.Cache differ diff --git a/BaseConverter/obj/Debug/BaseConverter.exe b/BaseConverter/obj/Debug/BaseConverter.exe index 3912c7f..4660b30 100644 Binary files a/BaseConverter/obj/Debug/BaseConverter.exe and b/BaseConverter/obj/Debug/BaseConverter.exe differ diff --git a/BaseConverter/obj/Debug/BaseConverter.exe.manifest b/BaseConverter/obj/Debug/BaseConverter.exe.manifest index 17897ce..452eee4 100644 --- a/BaseConverter/obj/Debug/BaseConverter.exe.manifest +++ b/BaseConverter/obj/Debug/BaseConverter.exe.manifest @@ -52,14 +52,14 @@ - + - dZXLG29YzjAwtfDgkFQyhpdG14U= + AZ1RyIR6zUElaFiQPabdRc1KQGU= diff --git a/BaseConverter/obj/Debug/BaseConverter.pdb b/BaseConverter/obj/Debug/BaseConverter.pdb index 5ec71b6..f693ad7 100644 Binary files a/BaseConverter/obj/Debug/BaseConverter.pdb and b/BaseConverter/obj/Debug/BaseConverter.pdb differ