How do you nudge a message box like the one in msn? Is there a easy method to do it?

I google it and found the codes below but it didn't work. And it seems too difficult for me to understand. prehaps is there a easier method to do the nudge?

public void NudgeMe()
{
    // Store the original location of the form.
    int xCoord = this.tmpFrm.Left;
    int yCoord = this.tmpFrm.Top;
    
    // An integer for storing the random number each time
    int rnd = 0;

    // Instantiate the random generation mechanism
    Random RandomClass = new Random();

    for (int i = 0;  i <= 500; i++)
    {
        rnd = RandomClass.Next(xCoord + 1, xCoord + 15);
        this.tmpFrm.Left = rnd;
        rnd = RandomClass.Next(yCoord + 1, yCoord + 15);
        this.tmpFrm.Top = rnd;
    }

    // Restore the original location of the form
    this.tmpFrm.Left = xCoord;
    this.tmpFrm.Top = yCoord;
}

Slightly adapted version allows "nudging" of any control.

public void NudgeControl(Control ctrl)
        {
            // Store the original location of the form.
            int xCoord = ctrl.Left;
            int yCoord = ctrl.Top;

            // An integer for storing the random number each time
            int rnd = 0;

            // Instantiate the random generation mechanism
            Random RandomClass = new Random();

            for (int i = 0; i <= 200; i++)
            {
                rnd = RandomClass.Next(xCoord + 1, xCoord + 15);
                ctrl.Left = rnd;
                rnd = RandomClass.Next(yCoord + 1, yCoord + 15);
                ctrl.Top = rnd;
            }

            // Restore the original location of the form
            ctrl.Left = xCoord;
            ctrl.Top = yCoord;
        }

The result is rather odd and not something that I would want to subject to my users.
However, to nudge the whole form when it opens, call the method in the form shown event.

private void Form1_Shown(object sender, EventArgs e)
        {
            NudgeControl(this);
        }

But how am i going use the above codes to nudge a message box when it displays a message?

You will have to code your own message box to do that.
It's just a simple form with a label and one or two buttons.

i can't seems to know where to start? After the message box initialize how do u nudge it? i tried this but can no longer continue...

MessageBox.Show(txtReminder.Text, "Reminder Time: \"" + lblAlarmDisplay.Text + "\"", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.