Click here to Skip to main content
15,888,190 members
Home / Discussions / C#
   

C#

 
GeneralRe: Do we need to schedule threads to diff processors? Pin
Eddy Vluggen18-Sep-13 6:48
professionalEddy Vluggen18-Sep-13 6:48 
QuestionMessage Closed Pin
15-Sep-13 20:44
xuantruongbn15-Sep-13 20:44 
AnswerRe: CreateKey Pin
Midnight Ahri15-Sep-13 21:15
Midnight Ahri15-Sep-13 21:15 
AnswerRe: CreateKey Pin
Dave Kreskowiak16-Sep-13 1:55
mveDave Kreskowiak16-Sep-13 1:55 
Questionshowing form from bottom wth timer Pin
eng.iris15-Sep-13 15:32
eng.iris15-Sep-13 15:32 
AnswerRe: showing form from bottom wth timer Pin
Midnight Ahri15-Sep-13 16:58
Midnight Ahri15-Sep-13 16:58 
GeneralRe: showing form from bottom wth timer Pin
eng.iris15-Sep-13 17:12
eng.iris15-Sep-13 17:12 
AnswerRe: showing form from bottom wth timer Pin
Midnight Ahri15-Sep-13 18:11
Midnight Ahri15-Sep-13 18:11 
Edit :
I changed your code but yeah it's messy.
My advice,
* Reduce timer usage
* Stop your timer when you don't need them (not keep returning)

C#
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            timer3.Interval = 1000;
        }

        bool flag = true;
        int delay = 0;

        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;
            }
            else
            {
                timer1.Enabled = false;
            }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            flag = false;
            if (this.Top > Screen.PrimaryScreen.Bounds.Height)
            {
                timer2.Enabled = false;
                timer3.Enabled = true;
                return;
            }

            else
            {
                this.Top = this.Top + 10;
                flag = true;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer2.Enabled = true;
        }

        private void timer3_Tick(object sender, EventArgs e)
        {
            if (this.delay >= 5) //delay for 5 second
            {
                this.delay = 0;
                timer1.Enabled = true;
                timer3.Enabled = false;
            }
            else
            {
                this.delay += 1;
            }
        }
    }


modified 16-Sep-13 0:37am.

GeneralRe: showing form from bottom wth timer Pin
eng.iris16-Sep-13 2:26
eng.iris16-Sep-13 2:26 
AnswerRe: showing form from bottom wth timer Pin
Kamran Ayati15-Sep-13 21:04
Kamran Ayati15-Sep-13 21:04 
GeneralRe: showing form from bottom wth timer Pin
eng.iris16-Sep-13 2:20
eng.iris16-Sep-13 2:20 
GeneralRe: showing form from bottom wth timer Pin
Kamran Ayati16-Sep-13 2:44
Kamran Ayati16-Sep-13 2:44 
GeneralRe: showing form from bottom wth timer Pin
eng.iris16-Sep-13 9:43
eng.iris16-Sep-13 9:43 
AnswerRe: showing form from bottom wth timer Pin
V.15-Sep-13 23:36
professionalV.15-Sep-13 23:36 
GeneralRe: showing form from bottom wth timer Pin
eng.iris16-Sep-13 2:30
eng.iris16-Sep-13 2:30 
GeneralRe: showing form from bottom wth timer Pin
V.16-Sep-13 2:35
professionalV.16-Sep-13 2:35 
GeneralRe: showing form from bottom wth timer Pin
eng.iris16-Sep-13 9:43
eng.iris16-Sep-13 9:43 
GeneralRe: showing form from bottom wth timer Pin
V.16-Sep-13 20:44
professionalV.16-Sep-13 20:44 
AnswerRe: showing form from bottom wth timer Pin
Midnight Ahri16-Sep-13 2:35
Midnight Ahri16-Sep-13 2:35 
GeneralRe: showing form from bottom wth timer Pin
eng.iris16-Sep-13 10:02
eng.iris16-Sep-13 10:02 
GeneralRe: showing form from bottom wth timer Pin
eng.iris17-Sep-13 7:54
eng.iris17-Sep-13 7:54 
AnswerRe: showing form from bottom wth timer Pin
Midnight Ahri17-Sep-13 17:26
Midnight Ahri17-Sep-13 17:26 
GeneralRe: showing form from bottom wth timer Pin
eng.iris18-Sep-13 7:13
eng.iris18-Sep-13 7:13 
Questionwpf backgroundworker, execution of processes one after another Pin
Member 974759714-Sep-13 19:55
Member 974759714-Sep-13 19:55 
AnswerRe: wpf backgroundworker, execution of processes one after another Pin
Abhinav S14-Sep-13 22:18
Abhinav S14-Sep-13 22:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.