Form SetDesktopLocation

R

randy1200

I created the program below in VS2005. Form2 opens just fine, but it ignores
the call to SetDesktopLocation(). Any ideas why? It seems like a should be
trivial to specify a screen location where a Form2 would open.

Thanks...

//////////////////////////////////////

namespace TestDialogPosition
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.SetDesktopLocation(500, 500);
f2.ShowDialog();
}
}
}
 
A

Aneesh Pulukkul[MCSD.Net]

I created the program below in VS2005. Form2 opens just fine, but it ignores
the call to SetDesktopLocation(). Any ideas why? It seems like a should be
trivial to specify a screen location where a Form2 would open.

Thanks...

//////////////////////////////////////

namespace TestDialogPosition
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            f2.SetDesktopLocation(500, 500);
            f2.ShowDialog();
        }
    }



}- Hide quoted text -

- Show quoted text -

If you jus want to set the start position of child form please try
this:

Form f2 = new Form();
f2.StartPosition = FormStartPosition.Manual;
f2.Location = new Point(500, 500);
f2.ShowDialog();
 
R

randy1200

That works perfectly! Many thanks!

Aneesh Pulukkul said:
If you jus want to set the start position of child form please try
this:

Form f2 = new Form();
f2.StartPosition = FormStartPosition.Manual;
f2.Location = new Point(500, 500);
f2.ShowDialog();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top