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?

Edited 6 Years Ago by imso: n/a

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.

Edited 6 Years Ago by nick.crane: n/a

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);
This question has already been answered. Start a new discussion instead.