using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using LMS = Laj.Mathematics.StringConvert; namespace MatteKalkylatorn { // Last modified: 2002-09-16 // Version: 0.45 ID:LAJ44001 // Compiles with Microsoft Visual C# .NET 7.0.9466 on Windows 95. // The source code is free. It is not under any kind of license. // If this code works, it was written by Lars Johansson, Göteborg. // If not, I don't know who wrote it. /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button buttonOpenAvaliableFunctions; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button buttonCalculatePreSetFormula; private System.Windows.Forms.Button buttonDerivative; private System.Windows.Forms.Button buttonIntegral; private System.Windows.Forms.Button buttonSolve; private System.Windows.Forms.Button buttonMaxOnInterval; private System.Windows.Forms.Button buttonMinOnInterval; private System.Windows.Forms.Button buttonPlot; private Laj.Controls.TextBoxNumber tBNCalculatePreSetFormula; private Laj.Controls.TextBoxNumberSpin tBNSCalculatePreSetFormula; private Laj.Controls.TextBoxNumber tBNDerivative; private Laj.Controls.TextBoxNumberSpin tBNSDerivative; private Laj.Controls.TextBoxNumberSpin tBNSIntegralB; private Laj.Controls.TextBoxNumberSpin tBNSIntegralA; private Laj.Controls.TextBoxNumber tBNIntegral; private Laj.Controls.TextBoxNumberSpin tBNSSolveB; private Laj.Controls.TextBoxNumberSpin tBNSSolveA; private Laj.Controls.TextBoxNumber tBNSolve; private Laj.Controls.TextBoxNumberSpin tBNSMaxOnIntervalB; private Laj.Controls.TextBoxNumberSpin tBNSMaxOnIntervalA; private Laj.Controls.TextBoxNumberSpin tBNSMinOnIntervalB; private Laj.Controls.TextBoxNumberSpin tBNSMinOnIntervalA; private Laj.Controls.TextBoxNumberSpin tBNSPlotB; private Laj.Controls.TextBoxNumberSpin tBNSPlotA; private Laj.Controls.TextBoxNumber tBNPlot; private System.Windows.Forms.Label label5; private Laj.Controls.TextBoxNumber tBNMaxOnIntervalX; private Laj.Controls.TextBoxNumber tBNMinOnIntervalX; private Laj.Controls.TextBoxNumber tBNMaxOnIntervalY; private Laj.Controls.TextBoxNumber tBNMinOnIntervalY; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { InitializeComponent(); string formula = "2*cos(3*x)+sin(2*x)"; comboBox1.Items.Insert(0, formula); comboBox1.SelectedIndex = 0; } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.buttonOpenAvaliableFunctions = new System.Windows.Forms.Button(); this.buttonCalculatePreSetFormula = new System.Windows.Forms.Button(); this.tBNCalculatePreSetFormula = new Laj.Controls.TextBoxNumber(); this.tBNSCalculatePreSetFormula = new Laj.Controls.TextBoxNumberSpin(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.tBNDerivative = new Laj.Controls.TextBoxNumber(); this.buttonDerivative = new System.Windows.Forms.Button(); this.tBNSDerivative = new Laj.Controls.TextBoxNumberSpin(); this.tBNSIntegralB = new Laj.Controls.TextBoxNumberSpin(); this.tBNSIntegralA = new Laj.Controls.TextBoxNumberSpin(); this.tBNIntegral = new Laj.Controls.TextBoxNumber(); this.buttonIntegral = new System.Windows.Forms.Button(); this.tBNSSolveB = new Laj.Controls.TextBoxNumberSpin(); this.tBNSSolveA = new Laj.Controls.TextBoxNumberSpin(); this.tBNSolve = new Laj.Controls.TextBoxNumber(); this.buttonSolve = new System.Windows.Forms.Button(); this.tBNSMaxOnIntervalB = new Laj.Controls.TextBoxNumberSpin(); this.tBNSMaxOnIntervalA = new Laj.Controls.TextBoxNumberSpin(); this.tBNMaxOnIntervalX = new Laj.Controls.TextBoxNumber(); this.buttonMaxOnInterval = new System.Windows.Forms.Button(); this.tBNSMinOnIntervalB = new Laj.Controls.TextBoxNumberSpin(); this.tBNSMinOnIntervalA = new Laj.Controls.TextBoxNumberSpin(); this.tBNMinOnIntervalX = new Laj.Controls.TextBoxNumber(); this.buttonMinOnInterval = new System.Windows.Forms.Button(); this.tBNSPlotB = new Laj.Controls.TextBoxNumberSpin(); this.tBNSPlotA = new Laj.Controls.TextBoxNumberSpin(); this.tBNPlot = new Laj.Controls.TextBoxNumber(); this.buttonPlot = new System.Windows.Forms.Button(); this.label5 = new System.Windows.Forms.Label(); this.tBNMaxOnIntervalY = new Laj.Controls.TextBoxNumber(); this.tBNMinOnIntervalY = new Laj.Controls.TextBoxNumber(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // comboBox1 // this.comboBox1.Location = new System.Drawing.Point(8, 24); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(344, 21); this.comboBox1.Sorted = true; this.comboBox1.TabIndex = 0; this.comboBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox1_KeyPress); // // label1 // this.label1.Location = new System.Drawing.Point(8, 8); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(100, 16); this.label1.TabIndex = 1; this.label1.Text = "Formula f(x)"; // // buttonOpenAvaliableFunctions // this.buttonOpenAvaliableFunctions.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, (System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.buttonOpenAvaliableFunctions.Location = new System.Drawing.Point(360, 24); this.buttonOpenAvaliableFunctions.Name = "buttonOpenAvaliableFunctions"; this.buttonOpenAvaliableFunctions.Size = new System.Drawing.Size(24, 21); this.buttonOpenAvaliableFunctions.TabIndex = 1; this.buttonOpenAvaliableFunctions.Text = "fx"; this.buttonOpenAvaliableFunctions.Click += new System.EventHandler(this.buttonOpenAvaliableFunctions_Click); // // buttonCalculatePreSetFormula // this.buttonCalculatePreSetFormula.Location = new System.Drawing.Point(152, 80); this.buttonCalculatePreSetFormula.Name = "buttonCalculatePreSetFormula"; this.buttonCalculatePreSetFormula.Size = new System.Drawing.Size(110, 23); this.buttonCalculatePreSetFormula.TabIndex = 3; this.buttonCalculatePreSetFormula.Text = "Value f(a)"; this.buttonCalculatePreSetFormula.Click += new System.EventHandler(this.buttonCalculatePreSetFormula_Click); // // tBNCalculatePreSetFormula // this.tBNCalculatePreSetFormula.AcceptEmptyBox = true; this.tBNCalculatePreSetFormula.CheckLowerLimit = false; this.tBNCalculatePreSetFormula.CheckUpperLimit = false; this.tBNCalculatePreSetFormula.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNCalculatePreSetFormula.EnterKeySendsNumberChanged = false; this.tBNCalculatePreSetFormula.Location = new System.Drawing.Point(272, 80); this.tBNCalculatePreSetFormula.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNCalculatePreSetFormula.Name = "tBNCalculatePreSetFormula"; this.tBNCalculatePreSetFormula.Number = 0; this.tBNCalculatePreSetFormula.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNCalculatePreSetFormula.NumberDecimalDigits = 4; this.tBNCalculatePreSetFormula.RoundToNumberDecimalDigits = false; this.tBNCalculatePreSetFormula.ShowLimitsInToolTip = true; this.tBNCalculatePreSetFormula.TabIndex = 4; this.tBNCalculatePreSetFormula.TakeLimits = false; this.tBNCalculatePreSetFormula.Text = ""; this.tBNCalculatePreSetFormula.UnitText = ""; this.tBNCalculatePreSetFormula.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); this.tBNCalculatePreSetFormula.DoubleClick += new System.EventHandler(this.changeNumberOfDecimals_DoubleClick); // // tBNSCalculatePreSetFormula // this.tBNSCalculatePreSetFormula.AcceptEmptyBox = false; this.tBNSCalculatePreSetFormula.CheckLowerLimit = false; this.tBNSCalculatePreSetFormula.CheckUpperLimit = false; this.tBNSCalculatePreSetFormula.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSCalculatePreSetFormula.EnterKeySendsNumberChanged = false; this.tBNSCalculatePreSetFormula.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSCalculatePreSetFormula.Location = new System.Drawing.Point(8, 80); this.tBNSCalculatePreSetFormula.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSCalculatePreSetFormula.Name = "tBNSCalculatePreSetFormula"; this.tBNSCalculatePreSetFormula.Number = 1; this.tBNSCalculatePreSetFormula.NumberDecimal = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSCalculatePreSetFormula.NumberDecimalDigits = 2; this.tBNSCalculatePreSetFormula.RoundToNumberDecimalDigits = false; this.tBNSCalculatePreSetFormula.ShowLimitsInToolTip = true; this.tBNSCalculatePreSetFormula.Size = new System.Drawing.Size(64, 20); this.tBNSCalculatePreSetFormula.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSCalculatePreSetFormula.TabIndex = 2; this.tBNSCalculatePreSetFormula.TakeLimits = false; this.tBNSCalculatePreSetFormula.UnitText = ""; this.tBNSCalculatePreSetFormula.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // label2 // this.label2.Location = new System.Drawing.Point(8, 56); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(40, 23); this.label2.TabIndex = 8; this.label2.Text = "a"; // // label3 // this.label3.Location = new System.Drawing.Point(80, 56); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(40, 23); this.label3.TabIndex = 9; this.label3.Text = "b"; // // label4 // this.label4.Location = new System.Drawing.Point(272, 56); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(40, 23); this.label4.TabIndex = 10; this.label4.Text = "Result"; // // tBNDerivative // this.tBNDerivative.AcceptEmptyBox = true; this.tBNDerivative.CheckLowerLimit = false; this.tBNDerivative.CheckUpperLimit = false; this.tBNDerivative.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNDerivative.EnterKeySendsNumberChanged = false; this.tBNDerivative.Location = new System.Drawing.Point(272, 112); this.tBNDerivative.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNDerivative.Name = "tBNDerivative"; this.tBNDerivative.Number = 0; this.tBNDerivative.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNDerivative.NumberDecimalDigits = 4; this.tBNDerivative.RoundToNumberDecimalDigits = false; this.tBNDerivative.ShowLimitsInToolTip = true; this.tBNDerivative.TabIndex = 7; this.tBNDerivative.TakeLimits = false; this.tBNDerivative.Text = ""; this.tBNDerivative.UnitText = ""; this.tBNDerivative.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); this.tBNDerivative.DoubleClick += new System.EventHandler(this.changeNumberOfDecimals_DoubleClick); // // buttonDerivative // this.buttonDerivative.Location = new System.Drawing.Point(152, 112); this.buttonDerivative.Name = "buttonDerivative"; this.buttonDerivative.Size = new System.Drawing.Size(110, 23); this.buttonDerivative.TabIndex = 6; this.buttonDerivative.Text = "Derivative f\'(a)"; this.buttonDerivative.Click += new System.EventHandler(this.buttonDerivative_Click); // // tBNSDerivative // this.tBNSDerivative.AcceptEmptyBox = false; this.tBNSDerivative.CheckLowerLimit = false; this.tBNSDerivative.CheckUpperLimit = false; this.tBNSDerivative.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSDerivative.EnterKeySendsNumberChanged = false; this.tBNSDerivative.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSDerivative.Location = new System.Drawing.Point(8, 112); this.tBNSDerivative.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSDerivative.Name = "tBNSDerivative"; this.tBNSDerivative.Number = 1; this.tBNSDerivative.NumberDecimal = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSDerivative.NumberDecimalDigits = 2; this.tBNSDerivative.RoundToNumberDecimalDigits = false; this.tBNSDerivative.ShowLimitsInToolTip = true; this.tBNSDerivative.Size = new System.Drawing.Size(64, 20); this.tBNSDerivative.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSDerivative.TabIndex = 5; this.tBNSDerivative.TakeLimits = false; this.tBNSDerivative.UnitText = ""; this.tBNSDerivative.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNSIntegralB // this.tBNSIntegralB.AcceptEmptyBox = false; this.tBNSIntegralB.CheckLowerLimit = false; this.tBNSIntegralB.CheckUpperLimit = false; this.tBNSIntegralB.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSIntegralB.EnterKeySendsNumberChanged = false; this.tBNSIntegralB.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSIntegralB.Location = new System.Drawing.Point(80, 144); this.tBNSIntegralB.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSIntegralB.Name = "tBNSIntegralB"; this.tBNSIntegralB.Number = 2; this.tBNSIntegralB.NumberDecimal = new System.Decimal(new int[] { 2, 0, 0, 0}); this.tBNSIntegralB.NumberDecimalDigits = 2; this.tBNSIntegralB.RoundToNumberDecimalDigits = false; this.tBNSIntegralB.ShowLimitsInToolTip = true; this.tBNSIntegralB.Size = new System.Drawing.Size(64, 20); this.tBNSIntegralB.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSIntegralB.TabIndex = 9; this.tBNSIntegralB.TakeLimits = false; this.tBNSIntegralB.UnitText = ""; this.tBNSIntegralB.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNSIntegralA // this.tBNSIntegralA.AcceptEmptyBox = false; this.tBNSIntegralA.CheckLowerLimit = false; this.tBNSIntegralA.CheckUpperLimit = false; this.tBNSIntegralA.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSIntegralA.EnterKeySendsNumberChanged = false; this.tBNSIntegralA.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSIntegralA.Location = new System.Drawing.Point(8, 144); this.tBNSIntegralA.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSIntegralA.Name = "tBNSIntegralA"; this.tBNSIntegralA.Number = 0; this.tBNSIntegralA.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNSIntegralA.NumberDecimalDigits = 2; this.tBNSIntegralA.RoundToNumberDecimalDigits = false; this.tBNSIntegralA.ShowLimitsInToolTip = true; this.tBNSIntegralA.Size = new System.Drawing.Size(64, 20); this.tBNSIntegralA.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSIntegralA.TabIndex = 8; this.tBNSIntegralA.TakeLimits = false; this.tBNSIntegralA.UnitText = ""; this.tBNSIntegralA.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNIntegral // this.tBNIntegral.AcceptEmptyBox = true; this.tBNIntegral.CheckLowerLimit = false; this.tBNIntegral.CheckUpperLimit = false; this.tBNIntegral.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNIntegral.EnterKeySendsNumberChanged = false; this.tBNIntegral.Location = new System.Drawing.Point(272, 144); this.tBNIntegral.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNIntegral.Name = "tBNIntegral"; this.tBNIntegral.Number = 0; this.tBNIntegral.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNIntegral.NumberDecimalDigits = 4; this.tBNIntegral.RoundToNumberDecimalDigits = false; this.tBNIntegral.ShowLimitsInToolTip = true; this.tBNIntegral.TabIndex = 11; this.tBNIntegral.TakeLimits = false; this.tBNIntegral.Text = ""; this.tBNIntegral.UnitText = ""; this.tBNIntegral.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); this.tBNIntegral.DoubleClick += new System.EventHandler(this.changeNumberOfDecimals_DoubleClick); // // buttonIntegral // this.buttonIntegral.Location = new System.Drawing.Point(152, 144); this.buttonIntegral.Name = "buttonIntegral"; this.buttonIntegral.Size = new System.Drawing.Size(110, 23); this.buttonIntegral.TabIndex = 10; this.buttonIntegral.Text = "Integral aSb (x) dx"; this.buttonIntegral.Click += new System.EventHandler(this.buttonIntegral_Click); // // tBNSSolveB // this.tBNSSolveB.AcceptEmptyBox = true; this.tBNSSolveB.CheckLowerLimit = false; this.tBNSSolveB.CheckUpperLimit = false; this.tBNSSolveB.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSSolveB.EnterKeySendsNumberChanged = false; this.tBNSSolveB.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSSolveB.Location = new System.Drawing.Point(80, 176); this.tBNSSolveB.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSSolveB.Name = "tBNSSolveB"; this.tBNSSolveB.Number = 2; this.tBNSSolveB.NumberDecimal = new System.Decimal(new int[] { 2, 0, 0, 0}); this.tBNSSolveB.NumberDecimalDigits = 2; this.tBNSSolveB.RoundToNumberDecimalDigits = false; this.tBNSSolveB.ShowLimitsInToolTip = true; this.tBNSSolveB.Size = new System.Drawing.Size(64, 20); this.tBNSSolveB.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSSolveB.TabIndex = 13; this.tBNSSolveB.TakeLimits = false; this.tBNSSolveB.UnitText = ""; this.tBNSSolveB.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNSSolveA // this.tBNSSolveA.AcceptEmptyBox = true; this.tBNSSolveA.CheckLowerLimit = false; this.tBNSSolveA.CheckUpperLimit = false; this.tBNSSolveA.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSSolveA.EnterKeySendsNumberChanged = false; this.tBNSSolveA.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSSolveA.Location = new System.Drawing.Point(8, 176); this.tBNSSolveA.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSSolveA.Name = "tBNSSolveA"; this.tBNSSolveA.Number = 0; this.tBNSSolveA.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNSSolveA.NumberDecimalDigits = 2; this.tBNSSolveA.RoundToNumberDecimalDigits = false; this.tBNSSolveA.ShowLimitsInToolTip = true; this.tBNSSolveA.Size = new System.Drawing.Size(64, 20); this.tBNSSolveA.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSSolveA.TabIndex = 12; this.tBNSSolveA.TakeLimits = false; this.tBNSSolveA.UnitText = ""; this.tBNSSolveA.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNSolve // this.tBNSolve.AcceptEmptyBox = true; this.tBNSolve.CheckLowerLimit = false; this.tBNSolve.CheckUpperLimit = false; this.tBNSolve.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSolve.EnterKeySendsNumberChanged = false; this.tBNSolve.Location = new System.Drawing.Point(272, 176); this.tBNSolve.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSolve.Name = "tBNSolve"; this.tBNSolve.Number = 0; this.tBNSolve.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNSolve.NumberDecimalDigits = 4; this.tBNSolve.RoundToNumberDecimalDigits = false; this.tBNSolve.ShowLimitsInToolTip = true; this.tBNSolve.TabIndex = 15; this.tBNSolve.TakeLimits = false; this.tBNSolve.Text = ""; this.tBNSolve.UnitText = ""; this.tBNSolve.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); this.tBNSolve.DoubleClick += new System.EventHandler(this.changeNumberOfDecimals_DoubleClick); // // buttonSolve // this.buttonSolve.Location = new System.Drawing.Point(152, 176); this.buttonSolve.Name = "buttonSolve"; this.buttonSolve.Size = new System.Drawing.Size(110, 23); this.buttonSolve.TabIndex = 14; this.buttonSolve.Text = "Find a zero f(x)=0"; this.buttonSolve.Click += new System.EventHandler(this.buttonSolve_Click); // // tBNSMaxOnIntervalB // this.tBNSMaxOnIntervalB.AcceptEmptyBox = false; this.tBNSMaxOnIntervalB.CheckLowerLimit = false; this.tBNSMaxOnIntervalB.CheckUpperLimit = false; this.tBNSMaxOnIntervalB.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSMaxOnIntervalB.EnterKeySendsNumberChanged = false; this.tBNSMaxOnIntervalB.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSMaxOnIntervalB.Location = new System.Drawing.Point(80, 208); this.tBNSMaxOnIntervalB.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSMaxOnIntervalB.Name = "tBNSMaxOnIntervalB"; this.tBNSMaxOnIntervalB.Number = 2; this.tBNSMaxOnIntervalB.NumberDecimal = new System.Decimal(new int[] { 2, 0, 0, 0}); this.tBNSMaxOnIntervalB.NumberDecimalDigits = 2; this.tBNSMaxOnIntervalB.RoundToNumberDecimalDigits = false; this.tBNSMaxOnIntervalB.ShowLimitsInToolTip = true; this.tBNSMaxOnIntervalB.Size = new System.Drawing.Size(64, 20); this.tBNSMaxOnIntervalB.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSMaxOnIntervalB.TabIndex = 17; this.tBNSMaxOnIntervalB.TakeLimits = false; this.tBNSMaxOnIntervalB.UnitText = ""; this.tBNSMaxOnIntervalB.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNSMaxOnIntervalA // this.tBNSMaxOnIntervalA.AcceptEmptyBox = false; this.tBNSMaxOnIntervalA.CheckLowerLimit = false; this.tBNSMaxOnIntervalA.CheckUpperLimit = false; this.tBNSMaxOnIntervalA.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSMaxOnIntervalA.EnterKeySendsNumberChanged = false; this.tBNSMaxOnIntervalA.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSMaxOnIntervalA.Location = new System.Drawing.Point(8, 208); this.tBNSMaxOnIntervalA.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSMaxOnIntervalA.Name = "tBNSMaxOnIntervalA"; this.tBNSMaxOnIntervalA.Number = 0; this.tBNSMaxOnIntervalA.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNSMaxOnIntervalA.NumberDecimalDigits = 2; this.tBNSMaxOnIntervalA.RoundToNumberDecimalDigits = false; this.tBNSMaxOnIntervalA.ShowLimitsInToolTip = true; this.tBNSMaxOnIntervalA.Size = new System.Drawing.Size(64, 20); this.tBNSMaxOnIntervalA.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSMaxOnIntervalA.TabIndex = 16; this.tBNSMaxOnIntervalA.TakeLimits = false; this.tBNSMaxOnIntervalA.UnitText = ""; this.tBNSMaxOnIntervalA.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNMaxOnIntervalX // this.tBNMaxOnIntervalX.AcceptEmptyBox = true; this.tBNMaxOnIntervalX.CheckLowerLimit = false; this.tBNMaxOnIntervalX.CheckUpperLimit = false; this.tBNMaxOnIntervalX.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNMaxOnIntervalX.EnterKeySendsNumberChanged = false; this.tBNMaxOnIntervalX.Location = new System.Drawing.Point(272, 208); this.tBNMaxOnIntervalX.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNMaxOnIntervalX.Name = "tBNMaxOnIntervalX"; this.tBNMaxOnIntervalX.Number = 0; this.tBNMaxOnIntervalX.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNMaxOnIntervalX.NumberDecimalDigits = 4; this.tBNMaxOnIntervalX.RoundToNumberDecimalDigits = false; this.tBNMaxOnIntervalX.ShowLimitsInToolTip = true; this.tBNMaxOnIntervalX.TabIndex = 19; this.tBNMaxOnIntervalX.TakeLimits = false; this.tBNMaxOnIntervalX.Text = ""; this.tBNMaxOnIntervalX.UnitText = ""; this.tBNMaxOnIntervalX.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); this.tBNMaxOnIntervalX.DoubleClick += new System.EventHandler(this.changeNumberOfDecimals_DoubleClick); // // buttonMaxOnInterval // this.buttonMaxOnInterval.Location = new System.Drawing.Point(152, 208); this.buttonMaxOnInterval.Name = "buttonMaxOnInterval"; this.buttonMaxOnInterval.Size = new System.Drawing.Size(110, 23); this.buttonMaxOnInterval.TabIndex = 18; this.buttonMaxOnInterval.Text = "Max of f(x) on [a, b]"; this.buttonMaxOnInterval.Click += new System.EventHandler(this.buttonMaxOnInterval_Click); // // tBNSMinOnIntervalB // this.tBNSMinOnIntervalB.AcceptEmptyBox = false; this.tBNSMinOnIntervalB.CheckLowerLimit = false; this.tBNSMinOnIntervalB.CheckUpperLimit = false; this.tBNSMinOnIntervalB.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSMinOnIntervalB.EnterKeySendsNumberChanged = false; this.tBNSMinOnIntervalB.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSMinOnIntervalB.Location = new System.Drawing.Point(80, 240); this.tBNSMinOnIntervalB.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSMinOnIntervalB.Name = "tBNSMinOnIntervalB"; this.tBNSMinOnIntervalB.Number = 2; this.tBNSMinOnIntervalB.NumberDecimal = new System.Decimal(new int[] { 2, 0, 0, 0}); this.tBNSMinOnIntervalB.NumberDecimalDigits = 2; this.tBNSMinOnIntervalB.RoundToNumberDecimalDigits = false; this.tBNSMinOnIntervalB.ShowLimitsInToolTip = true; this.tBNSMinOnIntervalB.Size = new System.Drawing.Size(64, 20); this.tBNSMinOnIntervalB.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSMinOnIntervalB.TabIndex = 21; this.tBNSMinOnIntervalB.TakeLimits = false; this.tBNSMinOnIntervalB.UnitText = ""; this.tBNSMinOnIntervalB.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNSMinOnIntervalA // this.tBNSMinOnIntervalA.AcceptEmptyBox = false; this.tBNSMinOnIntervalA.CheckLowerLimit = false; this.tBNSMinOnIntervalA.CheckUpperLimit = false; this.tBNSMinOnIntervalA.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSMinOnIntervalA.EnterKeySendsNumberChanged = false; this.tBNSMinOnIntervalA.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSMinOnIntervalA.Location = new System.Drawing.Point(8, 240); this.tBNSMinOnIntervalA.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSMinOnIntervalA.Name = "tBNSMinOnIntervalA"; this.tBNSMinOnIntervalA.Number = 0; this.tBNSMinOnIntervalA.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNSMinOnIntervalA.NumberDecimalDigits = 2; this.tBNSMinOnIntervalA.RoundToNumberDecimalDigits = false; this.tBNSMinOnIntervalA.ShowLimitsInToolTip = true; this.tBNSMinOnIntervalA.Size = new System.Drawing.Size(64, 20); this.tBNSMinOnIntervalA.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSMinOnIntervalA.TabIndex = 20; this.tBNSMinOnIntervalA.TakeLimits = false; this.tBNSMinOnIntervalA.UnitText = ""; this.tBNSMinOnIntervalA.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNMinOnIntervalX // this.tBNMinOnIntervalX.AcceptEmptyBox = true; this.tBNMinOnIntervalX.CheckLowerLimit = false; this.tBNMinOnIntervalX.CheckUpperLimit = false; this.tBNMinOnIntervalX.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNMinOnIntervalX.EnterKeySendsNumberChanged = false; this.tBNMinOnIntervalX.Location = new System.Drawing.Point(272, 240); this.tBNMinOnIntervalX.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNMinOnIntervalX.Name = "tBNMinOnIntervalX"; this.tBNMinOnIntervalX.Number = 0; this.tBNMinOnIntervalX.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNMinOnIntervalX.NumberDecimalDigits = 4; this.tBNMinOnIntervalX.RoundToNumberDecimalDigits = false; this.tBNMinOnIntervalX.ShowLimitsInToolTip = true; this.tBNMinOnIntervalX.TabIndex = 23; this.tBNMinOnIntervalX.TakeLimits = false; this.tBNMinOnIntervalX.Text = ""; this.tBNMinOnIntervalX.UnitText = ""; this.tBNMinOnIntervalX.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); this.tBNMinOnIntervalX.DoubleClick += new System.EventHandler(this.changeNumberOfDecimals_DoubleClick); // // buttonMinOnInterval // this.buttonMinOnInterval.Location = new System.Drawing.Point(152, 240); this.buttonMinOnInterval.Name = "buttonMinOnInterval"; this.buttonMinOnInterval.Size = new System.Drawing.Size(110, 23); this.buttonMinOnInterval.TabIndex = 22; this.buttonMinOnInterval.Text = "Min of f(x) on [a, b]"; this.buttonMinOnInterval.Click += new System.EventHandler(this.buttonMinOnInterval_Click); // // tBNSPlotB // this.tBNSPlotB.AcceptEmptyBox = false; this.tBNSPlotB.CheckLowerLimit = false; this.tBNSPlotB.CheckUpperLimit = false; this.tBNSPlotB.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSPlotB.EnterKeySendsNumberChanged = false; this.tBNSPlotB.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSPlotB.Location = new System.Drawing.Point(80, 272); this.tBNSPlotB.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSPlotB.Name = "tBNSPlotB"; this.tBNSPlotB.Number = 10; this.tBNSPlotB.NumberDecimal = new System.Decimal(new int[] { 10, 0, 0, 0}); this.tBNSPlotB.NumberDecimalDigits = 2; this.tBNSPlotB.RoundToNumberDecimalDigits = false; this.tBNSPlotB.ShowLimitsInToolTip = true; this.tBNSPlotB.Size = new System.Drawing.Size(64, 20); this.tBNSPlotB.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSPlotB.TabIndex = 25; this.tBNSPlotB.TakeLimits = false; this.tBNSPlotB.UnitText = ""; this.tBNSPlotB.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNSPlotA // this.tBNSPlotA.AcceptEmptyBox = false; this.tBNSPlotA.CheckLowerLimit = false; this.tBNSPlotA.CheckUpperLimit = false; this.tBNSPlotA.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNSPlotA.EnterKeySendsNumberChanged = false; this.tBNSPlotA.LargeIncrement = new System.Decimal(new int[] { 1, 0, 0, 0}); this.tBNSPlotA.Location = new System.Drawing.Point(8, 272); this.tBNSPlotA.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNSPlotA.Name = "tBNSPlotA"; this.tBNSPlotA.Number = -10; this.tBNSPlotA.NumberDecimal = new System.Decimal(new int[] { 10, 0, 0, -2147483648}); this.tBNSPlotA.NumberDecimalDigits = 2; this.tBNSPlotA.RoundToNumberDecimalDigits = false; this.tBNSPlotA.ShowLimitsInToolTip = true; this.tBNSPlotA.Size = new System.Drawing.Size(64, 20); this.tBNSPlotA.SmallIncrement = new System.Decimal(new int[] { 1, 0, 0, 65536}); this.tBNSPlotA.TabIndex = 24; this.tBNSPlotA.TakeLimits = false; this.tBNSPlotA.UnitText = ""; this.tBNSPlotA.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNPlot // this.tBNPlot.AcceptEmptyBox = true; this.tBNPlot.CheckLowerLimit = false; this.tBNPlot.CheckUpperLimit = false; this.tBNPlot.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNPlot.EnterKeySendsNumberChanged = false; this.tBNPlot.Location = new System.Drawing.Point(272, 272); this.tBNPlot.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNPlot.Name = "tBNPlot"; this.tBNPlot.Number = 0; this.tBNPlot.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNPlot.NumberDecimalDigits = 4; this.tBNPlot.RoundToNumberDecimalDigits = false; this.tBNPlot.ShowLimitsInToolTip = true; this.tBNPlot.TabIndex = 27; this.tBNPlot.TakeLimits = false; this.tBNPlot.Text = "TODO"; this.tBNPlot.UnitText = ""; this.tBNPlot.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); this.tBNPlot.DoubleClick += new System.EventHandler(this.changeNumberOfDecimals_DoubleClick); // // buttonPlot // this.buttonPlot.Location = new System.Drawing.Point(152, 272); this.buttonPlot.Name = "buttonPlot"; this.buttonPlot.Size = new System.Drawing.Size(110, 23); this.buttonPlot.TabIndex = 26; this.buttonPlot.Text = "Plot f(x) on [a, b]"; this.buttonPlot.Click += new System.EventHandler(this.buttonPlot_Click); // // label5 // this.label5.Location = new System.Drawing.Point(152, 56); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(64, 23); this.label5.TabIndex = 35; this.label5.Text = "Command"; // // tBNMaxOnIntervalY // this.tBNMaxOnIntervalY.AcceptEmptyBox = true; this.tBNMaxOnIntervalY.CheckLowerLimit = false; this.tBNMaxOnIntervalY.CheckUpperLimit = false; this.tBNMaxOnIntervalY.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNMaxOnIntervalY.EnterKeySendsNumberChanged = false; this.tBNMaxOnIntervalY.Location = new System.Drawing.Point(384, 208); this.tBNMaxOnIntervalY.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNMaxOnIntervalY.Name = "tBNMaxOnIntervalY"; this.tBNMaxOnIntervalY.Number = 0; this.tBNMaxOnIntervalY.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNMaxOnIntervalY.NumberDecimalDigits = 4; this.tBNMaxOnIntervalY.RoundToNumberDecimalDigits = false; this.tBNMaxOnIntervalY.ShowLimitsInToolTip = true; this.tBNMaxOnIntervalY.TabIndex = 36; this.tBNMaxOnIntervalY.TakeLimits = false; this.tBNMaxOnIntervalY.Text = ""; this.tBNMaxOnIntervalY.UnitText = ""; this.tBNMaxOnIntervalY.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // tBNMinOnIntervalY // this.tBNMinOnIntervalY.AcceptEmptyBox = true; this.tBNMinOnIntervalY.CheckLowerLimit = false; this.tBNMinOnIntervalY.CheckUpperLimit = false; this.tBNMinOnIntervalY.EditColor = System.Drawing.SystemColors.HotTrack; this.tBNMinOnIntervalY.EnterKeySendsNumberChanged = false; this.tBNMinOnIntervalY.Location = new System.Drawing.Point(384, 240); this.tBNMinOnIntervalY.LowerLimit = new System.Decimal(new int[] { 100, 0, 0, -2147483648}); this.tBNMinOnIntervalY.Name = "tBNMinOnIntervalY"; this.tBNMinOnIntervalY.Number = 0; this.tBNMinOnIntervalY.NumberDecimal = new System.Decimal(new int[] { 0, 0, 0, 0}); this.tBNMinOnIntervalY.NumberDecimalDigits = 4; this.tBNMinOnIntervalY.RoundToNumberDecimalDigits = false; this.tBNMinOnIntervalY.ShowLimitsInToolTip = true; this.tBNMinOnIntervalY.TabIndex = 37; this.tBNMinOnIntervalY.TakeLimits = false; this.tBNMinOnIntervalY.Text = ""; this.tBNMinOnIntervalY.UnitText = ""; this.tBNMinOnIntervalY.UpperLimit = new System.Decimal(new int[] { 100, 0, 0, 0}); // // label6 // this.label6.Location = new System.Drawing.Point(272, 193); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(40, 23); this.label6.TabIndex = 38; this.label6.Text = "x"; // // label7 // this.label7.Location = new System.Drawing.Point(384, 193); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(40, 23); this.label7.TabIndex = 39; this.label7.Text = "f(x)"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(496, 301); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.tBNMinOnIntervalY, this.tBNMaxOnIntervalY, this.label5, this.tBNSPlotB, this.tBNSPlotA, this.tBNPlot, this.buttonPlot, this.tBNSMinOnIntervalB, this.tBNSMinOnIntervalA, this.tBNMinOnIntervalX, this.buttonMinOnInterval, this.tBNSMaxOnIntervalB, this.tBNSMaxOnIntervalA, this.tBNMaxOnIntervalX, this.buttonMaxOnInterval, this.tBNSSolveB, this.tBNSSolveA, this.tBNSolve, this.buttonSolve, this.tBNSIntegralB, this.tBNSIntegralA, this.tBNIntegral, this.buttonIntegral, this.tBNSDerivative, this.tBNDerivative, this.buttonDerivative, this.label4, this.label3, this.label2, this.tBNSCalculatePreSetFormula, this.tBNCalculatePreSetFormula, this.buttonCalculatePreSetFormula, this.buttonOpenAvaliableFunctions, this.label1, this.comboBox1, this.label6, this.label7}); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "Form1"; this.Text = "MatteKalkylatorn"; this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } static Laj.Mathematics.MCParser parserPreSet = new Laj.Mathematics.MCParser(); Laj.Mathematics.Common.FunctionOneParameter func = new Laj.Mathematics.Common.FunctionOneParameter( parserPreSet.CalculatePreSetFormula); private void parserPreSetFormula() { string formula = comboBox1.Text; parserPreSet.PreSetFormula = formula; } private void comboBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if(e.KeyChar == (int)System.Windows.Forms.Keys.Enter) { string formula = comboBox1.Text; if (!comboBox1.Items.Contains(formula) ) { comboBox1.Items.Insert(0, formula); } e.Handled = true; } } private void buttonOpenAvaliableFunctions_Click(object sender, System.EventArgs e) { AvaliableFunctions af = new AvaliableFunctions(); string formula = comboBox1.Text; formula = af.UpdateFormulaModal(formula); if (formula != comboBox1.Text) { comboBox1.Items.Insert(0, formula); comboBox1.Text = formula; } } private void buttonCalculatePreSetFormula_Click(object sender, System.EventArgs e) { parserPreSetFormula(); double x = tBNSCalculatePreSetFormula.Number; try { double y = parserPreSet.CalculatePreSetFormula(x); tBNCalculatePreSetFormula.Number = y; } catch (Exception exc) { tBNCalculatePreSetFormula.Number = 0; //gais??? tBNCalculatePreSetFormula.Text = exc.Message; } } private void buttonDerivative_Click(object sender, System.EventArgs e) { parserPreSetFormula(); double x = tBNSDerivative.Number; double res = Laj.Mathematics.Analysis.Derivative.LajDerivative.Dfdx(func, x); tBNDerivative.Number = res; } private void buttonIntegral_Click(object sender, System.EventArgs e) { parserPreSetFormula(); double a = tBNSIntegralA.Number; double b = tBNSIntegralB.Number; double res = Laj.Mathematics.Analysis.Integral.LajTrapezoidal.Integral(func, a, b); tBNIntegral.Number = res; } private void buttonSolve_Click(object sender, System.EventArgs e) { parserPreSetFormula(); double g1 = tBNSSolveA.Number; double g2 = tBNSSolveB.Number; double res; if (tBNSSolveA.HasNumber && tBNSSolveB.HasNumber) res = Laj.Mathematics.Analysis.Root.LajBisect.Solve(func, g1, g2); else if (tBNSSolveA.HasNumber) res = Laj.Mathematics.Analysis.Root.LajBisect.Solve(func, g1); else res = Laj.Mathematics.Analysis.Root.LajBisect.Solve(func); tBNSolve.Number = res; } private void buttonMaxOnInterval_Click(object sender, System.EventArgs e) { parserPreSetFormula(); double a = tBNSMaxOnIntervalA.Number; double b = tBNSMaxOnIntervalB.Number; double xM; double yM = Laj.Mathematics.Analysis.MinMax.LajBruteForce.MaxOnInterval(func, a, b, out xM); tBNMaxOnIntervalX.Number = xM; tBNMaxOnIntervalY.Number = yM; } private void buttonMinOnInterval_Click(object sender, System.EventArgs e) { parserPreSetFormula(); double a = tBNSMinOnIntervalA.Number; double b = tBNSMinOnIntervalB.Number; double xM; double yM = Laj.Mathematics.Analysis.MinMax.LajBruteForce.MinOnInterval(func, a, b, out xM); tBNMinOnIntervalX.Number = xM; tBNMinOnIntervalY.Number = yM; } private void buttonPlot_Click(object sender, System.EventArgs e) { parserPreSetFormula(); double a = tBNSPlotA.Number; double b = tBNSPlotB.Number; } private void changeNumberOfDecimals_DoubleClick(object sender, System.EventArgs e) { int numberDecimals = ((Laj.Controls.TextBoxNumber)sender).NumberDecimalDigits; NumberOfDecimals nod = new NumberOfDecimals(); numberDecimals = nod.UpdateNumberOfDecimalsModal(numberDecimals); ((Laj.Controls.TextBoxNumber)sender).NumberDecimalDigits = numberDecimals; double number = ((Laj.Controls.TextBoxNumber)sender).Number; ((Laj.Controls.TextBoxNumber)sender).Text = LMS.ToString(number, numberDecimals); } } }