Programlama ve Elektronik

Programlama ve Elektronik (http://www.proelo.com/)
-   Örnek Kodlar (http://www.proelo.com/ornek-kodlar-87/)
-   -   Hız-Zaman (http://www.proelo.com/ornek-kodlar-87/hiz-zaman-707/)

McDroPp 17. May 2008 03:40 AM

Hız-Zaman
 
Hız Zaman
--------------------------------------------------------------------------------
Matematikçiler için örnek..
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typ eof(Form1));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.p ictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictu reBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(57 17);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(330 182);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// textBox1
//
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox1.Location = new System.Drawing.Point(128 224);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100 20);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "Zamanı Giriniz";
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// label1
//
this.label1.Font = new System.Drawing.Font("Verdana" 12F System.Drawing.FontStyle.Regular System.Drawing.GraphicsUnit.Point ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.MidnightBlue;
this.label1.Location = new System.Drawing.Point(152 272);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56 23);
this.label1.TabIndex = 2;
this.label1.Text = "Hız =";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Verdana" 12F System.Drawing.FontStyle.Regular System.Drawing.GraphicsUnit.Point ((byte)(0)));
this.label2.Location = new System.Drawing.Point(224 272);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(134 18);
this.label2.TabIndex = 3;
this.label2.Text = ".....................";
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button1.Location = new System.Drawing.Point(240 224);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(56 20);
this.button1.TabIndex = 4;
this.button1.Text = "Hesapla";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5 13);
this.BackColor = System.Drawing.Color.LightSteelBlue;
this.ClientSize = new System.Drawing.Size(440 326);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.pictureBox1);
this.Name = "Form1";
this.Text = "Hız Zaman Programı";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.p ictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void textBox1_TextChanged(object sender System.EventArgs e)
{


}

private void button1_Click(object sender System.EventArgs e)
{
Double vt;
if (textBox1.Text!="")
{
t=Convert.ToDouble(textBox1.Text);

if (t<10)
{
v=6*t;
label2.Text=Convert.ToString(v);
}
else if (t>=10 && t<=20)
{
v=60;
label2.Text=Convert.ToString(v);
}
else if (t>20 && t<=35)
{
v=60-(t-20)*4;
label2.Text=Convert.ToString(v);
}
else
label2.Text="Hatalı Giriş Yaptınız...";
}
else
label2.Text="Zamanı Giriniz !!!";

}

private void Form1_Load(object sender EventArgs e)
{

}
}
}


Bütün Zaman Ayarları WEZ +3.5 olarak düzenlenmiştir. şu Anki Saat: 06:36 PM .