21 Aralık 2013 Cumartesi

C # PROGRAMI İLE ÖRNEK SORULAR-45

YÜRÜYEN YAZI ÖRNEĞİ

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace YürüyenYazı
{
      /// <summary>
      /// Summary description for Form1.
      /// </summary>
      public class Form1 : System.Windows.Forms.Form
      {
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.Timer timer1;
  private System.ComponentModel.IContainer components;

            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()
            {
   this.components = new System.ComponentModel.Container();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.timer1 = new System.Windows.Forms.Timer(this.components);
   this.SuspendLayout();
   //
   // textBox1
   //
   this.textBox1.Location = new System.Drawing.Point(8, 8);
   this.textBox1.Name = "textBox1";
   this.textBox1.Size = new System.Drawing.Size(280, 20);
   this.textBox1.TabIndex = 0;
   this.textBox1.Text = "textBox1";
   //
   // timer1
   //
   this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
   //
   // Form1
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                              this.textBox1});
   this.Name = "Form1";
   this.Text = "Form1";
   this.Load += new System.EventHandler(this.Form1_Load);
   this.ResumeLayout(false);

  }
            #endregion

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

  private void Form1_Load(object sender, System.EventArgs e)
  {
   textBox1.Text = "Yürüyen yazı             ";
   timer1.Interval = 100;
   timer1.Enabled = true;
  }

  private void timer1_Tick(object sender, System.EventArgs e)
  {
     textBox1.Text = textBox1.Text.Substring(1)
                  + textBox1.Text.Substring(0,1);
  }
      }

}

Hiç yorum yok: