المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : showing form from bottom wth timer



C# Programming
09-16-2013, 06:00 AM
hi every body

i wish i could find somebody help

i want my window to be shown slowly from left corner up and then go down when a button clicked and after a atimer interval the form shown again

this the code i tries but the form doesnt shown again http://www.barakasoft.com/script/Forums/Images/smiley_sigh.gif http://www.barakasoft.com/script/Forums/Images/smiley_sigh.gif http://www.barakasoft.com/script/Forums/Images/smiley_sigh.gif


namespace moving_form { public partial class Form1 : Form { bool flag = true; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.Left = 0; // right -->Screen.PrimaryScreen.Bounds.Width - this.Width; this.Top = Screen.PrimaryScreen.Bounds.Height + this.Height - 30; // to make it in the corner + this.height timer1.Enabled = true; } private void timer1_Tick(object sender, EventArgs e) { flag = true; if (this.Top >= Screen.PrimaryScreen.Bounds.Height - this.Height - 30) this.Top = this.Top - 10; } private void button1_Click(object sender, EventArgs e) { timer2.Enabled = true; } private void timer2_Tick(object sender, EventArgs e) { flag = false; if (this.Top > Screen.PrimaryScreen.Bounds.Height) { return; } else { this.Top = this.Top + 10; flag = true; } } } }


thanx again