Files
RollCalculator/Form1.cs
T
2025-04-24 12:27:03 +02:00

36 lines
954 B
C#

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);
}
}
}
}