Quantcast
Viewing all articles
Browse latest Browse all 12583

I cannot get the location of Form1 from Form2 after I change the location of Form1 c#

1. I have two form (Form1 and Form2)

2. After I Run the program, I move the Form1 (= I change its location)

3. The Form1 contains a button which shows the Form2

4. I press the button

The idea is that I want Form2 to have the same location as Form1 so in Form2 I used this:

Form1 f1 = new Form1();
this.Location = new Point(f1.Location.X, f1.Location.Y);
this.TopMost = true;

The porblem is that: Form2 appears right in the left corner of the screen (= it has the location {0,0}). Why?!

Please help!



Viewing all articles
Browse latest Browse all 12583

Trending Articles