Osman Bur
using System;
using System.Windows.Forms;
namespace KAYAN_YAZI
{
public partial class Form1 : Form
{
private int xPos = 0, YPos = 0,Hiz=5;
public string mode = "SoSa";
public string mode1 = "Asagi";
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (mode == "SoSa")
{
int ss = -lblMesaj.Width;
if (this.Width < xPos)
{
xPos= ss;
this.lblMesaj.Location = new System.Drawing.Point(xPos, YPos);
xPos += Hiz;
}
else
{
this.lblMesaj.Location = new System.Drawing.Point(xPos, YPos);
xPos += Hiz;
}
}
else if (mode == "SaSo")
{
if (xPos < (-lblMesaj.Width))
{
this.lblMesaj.Location = new System.Drawing.Point(this.Width, YPos);
xPos = this.Width;
}
else
{
this.lblMesaj.Location = new System.Drawing.Point(xPos, YPos);
xPos -= Hiz;
}
}
if (mode == "Asagi")
{
int ss = -lblMesaj.Height;
if (this.Height < YPos)
{
YPos = ss;
this.lblMesaj.Location = new System.Drawing.Point(xPos, YPos);
YPos += Hiz;
}
else
{
this.lblMesaj.Location = new System.Drawing.Point(xPos, YPos);
YPos += Hiz;
}
}
else if(mode == "Yukari")
{
if (YPos < (-lblMesaj.Height))
{
this.lblMesaj.Location = new System.Drawing.Point(this.Width, YPos);
YPos = this.Height;
}
else
{
this.lblMesaj.Location = new System.Drawing.Point(xPos, YPos);
YPos -= Hiz;
}
}
}
private void button2_Click(object sender, EventArgs e)
{
xPos = lblMesaj.Location.X;
YPos = lblMesaj.Location.Y;
mode = "SaSo";
timer1.Start();
}
private void button1_Click(object sender, EventArgs e)
{
xPos = lblMesaj.Location.X;
YPos = lblMesaj.Location.Y;
mode = "SoSa";
timer1.Start();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
Hiz = Convert.ToInt32(comboBox1.Text);
}
private void button4_Click(object sender, EventArgs e)
{
xPos = lblMesaj.Location.X;
YPos = lblMesaj.Location.Y;
mode = "Yukari";
timer1.Start();
}
private void button5_Click(object sender, EventArgs e)
{
xPos = lblMesaj.Location.X;
YPos = lblMesaj.Location.Y;
mode = "Asagi";
timer1.Start();
}
private void button3_Click(object sender, EventArgs e)
{
if (button3.Text== "DUR")
{
button3.Text = "DEVAM";
timer1.Stop();
}
else
{
button3.Text = "DUR";
xPos = lblMesaj.Location.X;
YPos = lblMesaj.Location.Y;
timer1.Start();
}
}
}
}