UYGULAMAYI İNDİR
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Doğru_Denklemi
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblDenklem;
private System.Windows.Forms.TextBox txtA;
private System.Windows.Forms.Label lblX;
private System.Windows.Forms.TextBox txtB;
private System.Windows.Forms.Label lblY;
private System.Windows.Forms.TextBox txtC;
private System.Windows.Forms.Label lblSonuc;
private System.Windows.Forms.Button btnDegerleriListele;
private System.Windows.Forms.ListBox liste;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
private void btnDegerleriListele_Click(object sender, System.EventArgs e)
{
if (txtA.Text == "" || txtB.Text == "" || txtC.Text == "")
{
return;
}
liste.Items.Clear();
double a, b, c, x, y;
a = Convert.ToDouble(txtA.Text);
b = Convert.ToDouble(txtB.Text);
c = Convert.ToDouble(txtC.Text);
x = 0;
while (x < 100)
{
//buradaki x değeri için y değerini hesaplayalım
y = (-a * x - c) / b;
//x ve y değerlerini listbox a ekleyelim
liste.Items.Add("x = " + Convert.ToString(x) + " => y " + Convert.ToString(y));
x = x + 1;
}
}
///
/// 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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.lblDenklem = new System.Windows.Forms.Label();
this.txtA = new System.Windows.Forms.TextBox();
this.lblX = new System.Windows.Forms.Label();
this.txtB = new System.Windows.Forms.TextBox();
this.lblY = new System.Windows.Forms.Label();
this.txtC = new System.Windows.Forms.TextBox();
this.lblSonuc = new System.Windows.Forms.Label();
this.btnDegerleriListele = new System.Windows.Forms.Button();
this.liste = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// lblDenklem
//
this.lblDenklem.AutoSize = true;
this.lblDenklem.Font = new System.Drawing.Font("Comic Sans MS", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.lblDenklem.ForeColor = System.Drawing.Color.Firebrick;
this.lblDenklem.Location = new System.Drawing.Point(88, 11);
this.lblDenklem.Name = "lblDenklem";
this.lblDenklem.Size = new System.Drawing.Size(114, 27);
this.lblDenklem.TabIndex = 0;
this.lblDenklem.Text = "ax+by+c=0";
//
// txtA
//
this.txtA.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtA.Location = new System.Drawing.Point(33, 46);
this.txtA.Name = "txtA";
this.txtA.Size = new System.Drawing.Size(40, 20);
this.txtA.TabIndex = 1;
//
// lblX
//
this.lblX.AutoSize = true;
this.lblX.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.lblX.ForeColor = System.Drawing.Color.Firebrick;
this.lblX.Location = new System.Drawing.Point(73, 42);
this.lblX.Name = "lblX";
this.lblX.Size = new System.Drawing.Size(43, 23);
this.lblX.TabIndex = 0;
this.lblX.Text = "x + ";
//
// txtB
//
this.txtB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtB.Location = new System.Drawing.Point(105, 46);
this.txtB.Name = "txtB";
this.txtB.Size = new System.Drawing.Size(40, 20);
this.txtB.TabIndex = 3;
//
// lblY
//
this.lblY.AutoSize = true;
this.lblY.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.lblY.ForeColor = System.Drawing.Color.Firebrick;
this.lblY.Location = new System.Drawing.Point(150, 42);
this.lblY.Name = "lblY";
this.lblY.Size = new System.Drawing.Size(43, 23);
this.lblY.TabIndex = 2;
this.lblY.Text = "y + ";
//
// txtC
//
this.txtC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtC.Location = new System.Drawing.Point(182, 46);
this.txtC.Name = "txtC";
this.txtC.Size = new System.Drawing.Size(40, 20);
this.txtC.TabIndex = 4;
//
// lblSonuc
//
this.lblSonuc.AutoSize = true;
this.lblSonuc.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.lblSonuc.ForeColor = System.Drawing.Color.Firebrick;
this.lblSonuc.Location = new System.Drawing.Point(223, 43);
this.lblSonuc.Name = "lblSonuc";
this.lblSonuc.Size = new System.Drawing.Size(44, 23);
this.lblSonuc.TabIndex = 5;
this.lblSonuc.Text = " = 0";
//
// btnDegerleriListele
//
this.btnDegerleriListele.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnDegerleriListele.Location = new System.Drawing.Point(33, 72);
this.btnDegerleriListele.Name = "btnDegerleriListele";
this.btnDegerleriListele.Size = new System.Drawing.Size(189, 29);
this.btnDegerleriListele.TabIndex = 6;
this.btnDegerleriListele.Text = "Listele";
this.btnDegerleriListele.Click += new System.EventHandler(this.btnDegerleriListele_Click);
//
// liste
//
this.liste.Location = new System.Drawing.Point(33, 107);
this.liste.Name = "liste";
this.liste.Size = new System.Drawing.Size(234, 199);
this.liste.TabIndex = 7;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
this.ClientSize = new System.Drawing.Size(314, 316);
this.Controls.Add(this.liste);
this.Controls.Add(this.btnDegerleriListele);
this.Controls.Add(this.lblSonuc);
this.Controls.Add(this.txtC);
this.Controls.Add(this.txtB);
this.Controls.Add(this.lblY);
this.Controls.Add(this.txtA);
this.Controls.Add(this.lblDenklem);
this.Controls.Add(this.lblX);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "Birinci Dereceden Denklemler";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
Hiç yorum yok :
Yorum Gönder