Added auto compute function and toggle.
This commit is contained in:
parent
7c7f077705
commit
e911fc48d2
42
BaseConverter/Form1.Designer.cs
generated
42
BaseConverter/Form1.Designer.cs
generated
@ -46,6 +46,7 @@ namespace WindowsFormsApplication1
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="autoComputeToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -11,7 +11,7 @@
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
|
||||
<dsig:DigestValue>cEX9hsGiiCx0dr+SNR+Qk8kAYHI=</dsig:DigestValue>
|
||||
<dsig:DigestValue>yuucww+k7TDTPDj046KVMAquP4M=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
Binary file not shown.
@ -52,14 +52,14 @@
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="BaseConverter.exe" size="12800">
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="BaseConverter.exe" size="13824">
|
||||
<assemblyIdentity name="BaseConverter" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
|
||||
<dsig:DigestValue>dZXLG29YzjAwtfDgkFQyhpdG14U=</dsig:DigestValue>
|
||||
<dsig:DigestValue>AZ1RyIR6zUElaFiQPabdRc1KQGU=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
Binary file not shown.
@ -11,7 +11,7 @@
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
|
||||
<dsig:DigestValue>cEX9hsGiiCx0dr+SNR+Qk8kAYHI=</dsig:DigestValue>
|
||||
<dsig:DigestValue>yuucww+k7TDTPDj046KVMAquP4M=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
|
||||
<dsig:DigestValue>cEX9hsGiiCx0dr+SNR+Qk8kAYHI=</dsig:DigestValue>
|
||||
<dsig:DigestValue>yuucww+k7TDTPDj046KVMAquP4M=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
Binary file not shown.
Binary file not shown.
@ -52,14 +52,14 @@
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="BaseConverter.exe" size="12800">
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="BaseConverter.exe" size="13824">
|
||||
<assemblyIdentity name="BaseConverter" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
|
||||
<dsig:DigestValue>dZXLG29YzjAwtfDgkFQyhpdG14U=</dsig:DigestValue>
|
||||
<dsig:DigestValue>AZ1RyIR6zUElaFiQPabdRc1KQGU=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user