diff --git a/Form1.Designer.cs b/Form1.Designer.cs new file mode 100644 index 0000000..10bbd59 --- /dev/null +++ b/Form1.Designer.cs @@ -0,0 +1,120 @@ +namespace RollCalculator +{ + partial class Form1 + { + private System.ComponentModel.IContainer components = null; + private System.Windows.Forms.TextBox txtL1; + private System.Windows.Forms.TextBox txtD1; + private System.Windows.Forms.TextBox txtH1; + private System.Windows.Forms.TextBox txtL2; + private System.Windows.Forms.TextBox txtH2; + private System.Windows.Forms.Button btnBerechnen; + private System.Windows.Forms.Label lblErgebnis; + private System.Windows.Forms.Label lblFooter; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + private void InitializeComponent() + { + this.txtL1 = new System.Windows.Forms.TextBox(); + this.txtD1 = new System.Windows.Forms.TextBox(); + this.txtH1 = new System.Windows.Forms.TextBox(); + this.txtL2 = new System.Windows.Forms.TextBox(); + this.txtH2 = new System.Windows.Forms.TextBox(); + this.btnBerechnen = new System.Windows.Forms.Button(); + this.lblErgebnis = new System.Windows.Forms.Label(); + this.lblFooter = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // txtL1 + // + this.txtL1.Location = new System.Drawing.Point(30, 20); + this.txtL1.Name = "txtL1"; + this.txtL1.Size = new System.Drawing.Size(200, 20); + this.txtL1.TabIndex = 0; + this.txtL1.PlaceholderText = "Original length (m)"; + // + // txtD1 + // + this.txtD1.Location = new System.Drawing.Point(30, 50); + this.txtD1.Name = "txtD1"; + this.txtD1.Size = new System.Drawing.Size(200, 20); + this.txtD1.TabIndex = 1; + this.txtD1.PlaceholderText = "Original outer diameter (cm)"; + // + // txtH1 + // + this.txtH1.Location = new System.Drawing.Point(30, 80); + this.txtH1.Name = "txtH1"; + this.txtH1.Size = new System.Drawing.Size(200, 20); + this.txtH1.TabIndex = 2; + this.txtH1.PlaceholderText = "Original core diameter (cm)"; + // + // txtL2 + // + this.txtL2.Location = new System.Drawing.Point(30, 110); + this.txtL2.Name = "txtL2"; + this.txtL2.Size = new System.Drawing.Size(200, 20); + this.txtL2.TabIndex = 3; + this.txtL2.PlaceholderText = "New length (m)"; + // + // txtH2 + // + this.txtH2.Location = new System.Drawing.Point(30, 140); + this.txtH2.Name = "txtH2"; + this.txtH2.Size = new System.Drawing.Size(200, 20); + this.txtH2.TabIndex = 4; + this.txtH2.PlaceholderText = "New core diameter (cm)"; + // + // btnBerechnen + // + this.btnBerechnen.Location = new System.Drawing.Point(30, 170); + this.btnBerechnen.Name = "btnBerechnen"; + this.btnBerechnen.Size = new System.Drawing.Size(200, 30); + this.btnBerechnen.TabIndex = 5; + this.btnBerechnen.Text = "Calculate"; + this.btnBerechnen.UseVisualStyleBackColor = true; + this.btnBerechnen.Click += new System.EventHandler(this.btnBerechnen_Click); + // + // lblErgebnis + // + this.lblErgebnis.AutoSize = true; + this.lblErgebnis.Location = new System.Drawing.Point(30, 210); + this.lblErgebnis.Name = "lblErgebnis"; + this.lblErgebnis.Size = new System.Drawing.Size(0, 13); + this.lblErgebnis.TabIndex = 6; + // + // lblFooter + // + this.lblFooter.AutoSize = true; + this.lblFooter.Location = new System.Drawing.Point(30, 240); + this.lblFooter.Name = "lblFooter"; + this.lblFooter.Size = new System.Drawing.Size(220, 13); + this.lblFooter.TabIndex = 7; + this.lblFooter.Text = "Ver. 0.1beta - contact mtazl@naue.com"; + // + // Form1 + // + this.ClientSize = new System.Drawing.Size(284, 270); + this.Controls.Add(this.lblFooter); + this.Controls.Add(this.lblErgebnis); + this.Controls.Add(this.btnBerechnen); + this.Controls.Add(this.txtH2); + this.Controls.Add(this.txtL2); + this.Controls.Add(this.txtH1); + this.Controls.Add(this.txtD1); + this.Controls.Add(this.txtL1); + this.Name = "Form1"; + this.Text = "Roll Calculator"; + this.ResumeLayout(false); + this.PerformLayout(); + } + } +} \ No newline at end of file diff --git a/Form1.cs b/Form1.cs new file mode 100644 index 0000000..3e4beb1 --- /dev/null +++ b/Form1.cs @@ -0,0 +1,36 @@ +using System; +using System.Windows.Forms; + +namespace RollCalculator +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void btnBerechnen_Click(object sender, EventArgs e) + { + try + { + double L1 = double.Parse(txtL1.Text); + double D1 = double.Parse(txtD1.Text); + double H1 = double.Parse(txtH1.Text); + double L2 = double.Parse(txtL2.Text); + double H2 = double.Parse(txtH2.Text); + + double A1 = D1 * D1 - H1 * H1; + double A2 = L2 * A1 / L1; + + double D2 = Math.Sqrt(A2 + H2 * H2); + + lblErgebnis.Text = $"New outer diameter: {D2:F2} cm"; + } + catch (Exception ex) + { + MessageBox.Show("Error during calculation: " + ex.Message); + } + } + } +} \ No newline at end of file diff --git a/Form1.resx b/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Naue_Bildmarke_N_gruen.ico b/Naue_Bildmarke_N_gruen.ico new file mode 100644 index 0000000..45e3241 Binary files /dev/null and b/Naue_Bildmarke_N_gruen.ico differ diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..6832cfc --- /dev/null +++ b/Program.cs @@ -0,0 +1,16 @@ +using System; +using System.Windows.Forms; + +namespace RollCalculator +{ + static class Program + { + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} \ No newline at end of file diff --git a/RollCalculator.csproj b/RollCalculator.csproj new file mode 100644 index 0000000..c27cd77 --- /dev/null +++ b/RollCalculator.csproj @@ -0,0 +1,11 @@ + + + + WinExe + net9.0-windows + enable + true + enable + + + \ No newline at end of file diff --git a/RollCalculator.sln b/RollCalculator.sln new file mode 100644 index 0000000..903c49b --- /dev/null +++ b/RollCalculator.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35931.197 d17.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RollCalculator", "RollCalculator.csproj", "{8F884BFB-BFC5-4A8B-BDEF-AFF0427167B4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8F884BFB-BFC5-4A8B-BDEF-AFF0427167B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F884BFB-BFC5-4A8B-BDEF-AFF0427167B4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F884BFB-BFC5-4A8B-BDEF-AFF0427167B4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F884BFB-BFC5-4A8B-BDEF-AFF0427167B4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FD514568-8D9D-4426-B127-021D46641B60} + EndGlobalSection +EndGlobal