18 Temmuz 2008 Cuma

C# Ekran Koruyucusu


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace EkranKoruyucusu
{
public partial class Ekran : Form
{
int Xartisi = 2;
int Yartisi = 2;
public Ekran()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{

btnKup.Left = btnKup.Left + Xartisi;
btnKup.Top = btnKup.Top + Yartisi;
if (btnKup.Left > this.ClientRectangle.Width - btnKup.Width)
Xartisi *= -1;
if (btnKup.Left <> this.ClientRectangle.Height - btnKup.Height)
Yartisi *= -1;
if (btnKup.Top < 0)
Yartisi *= -1;
}
private void Ekran_Load(object sender, EventArgs e)
{
timer1.Start();
}
}
}

Hiç yorum yok: