diff --git a/MasodfokuGUI.sln b/MasodfokuGUI.sln new file mode 100644 index 0000000..1a9fcf6 --- /dev/null +++ b/MasodfokuGUI.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MasodfokuGUI", "MasodfokuGUI\MasodfokuGUI.csproj", "{69F51657-5C00-47F8-8E2C-BDE99BE96044}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {69F51657-5C00-47F8-8E2C-BDE99BE96044}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69F51657-5C00-47F8-8E2C-BDE99BE96044}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69F51657-5C00-47F8-8E2C-BDE99BE96044}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69F51657-5C00-47F8-8E2C-BDE99BE96044}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FE8B1A86-9908-44D6-B303-A60955E838F4} + EndGlobalSection +EndGlobal diff --git a/MasodfokuGUI/App.config b/MasodfokuGUI/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/MasodfokuGUI/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MasodfokuGUI/Form1.Designer.cs b/MasodfokuGUI/Form1.Designer.cs new file mode 100644 index 0000000..095b74f --- /dev/null +++ b/MasodfokuGUI/Form1.Designer.cs @@ -0,0 +1,188 @@ +namespace MasodfokuGUI +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (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() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.ellenorzogomb = new System.Windows.Forms.Button(); + this.label4 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.textBox1.Location = new System.Drawing.Point(38, 106); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(74, 29); + this.textBox1.TabIndex = 1; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.textBox2.Location = new System.Drawing.Point(215, 104); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(65, 29); + this.textBox2.TabIndex = 2; + this.textBox2.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.textBox3.Location = new System.Drawing.Point(401, 102); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(77, 29); + this.textBox3.TabIndex = 3; + this.textBox3.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // label2 + // + this.label2.BackColor = System.Drawing.SystemColors.Control; + this.label2.Font = new System.Drawing.Font("Microsoft YaHei", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.label2.Location = new System.Drawing.Point(129, 104); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(58, 27); + this.label2.TabIndex = 4; + this.label2.Text = "x^2+"; + // + // label5 + // + this.label5.BackColor = System.Drawing.SystemColors.Control; + this.label5.Font = new System.Drawing.Font("Microsoft YaHei", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.label5.Location = new System.Drawing.Point(316, 104); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(58, 27); + this.label5.TabIndex = 7; + this.label5.Text = "x+"; + // + // label3 + // + this.label3.BackColor = System.Drawing.SystemColors.Control; + this.label3.Font = new System.Drawing.Font("Microsoft YaHei", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.label3.Location = new System.Drawing.Point(503, 106); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(58, 27); + this.label3.TabIndex = 8; + this.label3.Text = "=0"; + // + // label1 + // + this.label1.BackColor = System.Drawing.SystemColors.Control; + this.label1.Font = new System.Drawing.Font("Microsoft YaHei", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.label1.Location = new System.Drawing.Point(86, 57); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(401, 27); + this.label1.TabIndex = 9; + this.label1.Text = "Adja meg az egyenlet együtthatóit!"; + // + // ellenorzogomb + // + this.ellenorzogomb.BackColor = System.Drawing.SystemColors.ButtonFace; + this.ellenorzogomb.Font = new System.Drawing.Font("Microsoft Tai Le", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.ellenorzogomb.Location = new System.Drawing.Point(115, 155); + this.ellenorzogomb.Name = "ellenorzogomb"; + this.ellenorzogomb.Size = new System.Drawing.Size(342, 38); + this.ellenorzogomb.TabIndex = 10; + this.ellenorzogomb.Text = "Ellenőríz és számol"; + this.ellenorzogomb.UseVisualStyleBackColor = false; + this.ellenorzogomb.Click += new System.EventHandler(this.button1_Click); + // + // label4 + // + this.label4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); + this.label4.Location = new System.Drawing.Point(74, 235); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(425, 33); + this.label4.TabIndex = 11; + // + // label6 + // + this.label6.BackColor = System.Drawing.Color.Gainsboro; + this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.label6.Location = new System.Drawing.Point(74, 298); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(425, 33); + this.label6.TabIndex = 12; + this.label6.Text = "x1="; + // + // label7 + // + this.label7.BackColor = System.Drawing.Color.LightGray; + this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.label7.Location = new System.Drawing.Point(74, 365); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(425, 33); + this.label7.TabIndex = 13; + this.label7.Text = "x2="; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(565, 450); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label4); + this.Controls.Add(this.ellenorzogomb); + this.Controls.Add(this.label1); + this.Controls.Add(this.label3); + this.Controls.Add(this.label5); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button ellenorzogomb; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + public System.Windows.Forms.TextBox textBox2; + } +} + diff --git a/MasodfokuGUI/Form1.cs b/MasodfokuGUI/Form1.cs new file mode 100644 index 0000000..4453353 --- /dev/null +++ b/MasodfokuGUI/Form1.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace MasodfokuGUI +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + try + { + double a; + double b; + double c; + + try + { + a = double.Parse(textBox1.Text); + } + catch (Exception) + { + + throw new Exception("Nem számot adott meg az 1. együtthatóként!"); + } + if (!double.TryParse(textBox2.Text, out b) ) + { + throw new Exception("Nem számot adott meg az 2. együtthatóként!"); + } + if (!double.TryParse(textBox3.Text, out c) ) + { + throw new Exception("Nem számot adott meg az 3. együtthatóként!"); + } + if(a==0) + { + throw new Exception("Az első együttható nulla!"); + } + + double d = b * b - 4 * a * c; + if (d < 0) + { + throw new Exception("Az egyenletnek nincs valós gyöke (diszkr.=0)!"); + } + if(d>0) + { + double x2 = (-b - Math.Sqrt(d)) / (2 * a); + label7.Text = $"x2 ={x2}"; + } + double x1 = (-b + Math.Sqrt(d)) / (2 * a); + label6.Text = $"x1 ={x1}"; + + } + catch (Exception hiba) + { + + label4.Text =hiba.Message; + } + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + label4.Text = ""; + label6.Text = "x1="; + label7.Text = "x2="; + } + } +} diff --git a/MasodfokuGUI/Form1.resx b/MasodfokuGUI/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/MasodfokuGUI/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/MasodfokuGUI/MasodfokuGUI.csproj b/MasodfokuGUI/MasodfokuGUI.csproj new file mode 100644 index 0000000..ed4082e --- /dev/null +++ b/MasodfokuGUI/MasodfokuGUI.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {69F51657-5C00-47F8-8E2C-BDE99BE96044} + WinExe + MasodfokuGUI + MasodfokuGUI + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/MasodfokuGUI/Program.cs b/MasodfokuGUI/Program.cs new file mode 100644 index 0000000..5c14e67 --- /dev/null +++ b/MasodfokuGUI/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace MasodfokuGUI +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/MasodfokuGUI/Properties/AssemblyInfo.cs b/MasodfokuGUI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3f0daff --- /dev/null +++ b/MasodfokuGUI/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MasodfokuGUI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MasodfokuGUI")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("69f51657-5c00-47f8-8e2c-bde99be96044")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MasodfokuGUI/Properties/Resources.Designer.cs b/MasodfokuGUI/Properties/Resources.Designer.cs new file mode 100644 index 0000000..04e8d4e --- /dev/null +++ b/MasodfokuGUI/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MasodfokuGUI.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MasodfokuGUI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/MasodfokuGUI/Properties/Resources.resx b/MasodfokuGUI/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/MasodfokuGUI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MasodfokuGUI/Properties/Settings.Designer.cs b/MasodfokuGUI/Properties/Settings.Designer.cs new file mode 100644 index 0000000..fa5efb3 --- /dev/null +++ b/MasodfokuGUI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MasodfokuGUI.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/MasodfokuGUI/Properties/Settings.settings b/MasodfokuGUI/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/MasodfokuGUI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +