[C#]Window positions.

09/20/2014 22:01 Fordaka#1
I'm trying to move the window 3 automatically when window 2 is moving, es ist jedoch langsam. :(

Form2.cs
PHP Code:
public static String LocationX;
        public static 
String LocationY;
        private 
void timer1_Tick(object senderEventArgs e)
        {
            
LocationX this.Location.X.ToString();
            
LocationY this.Location.Y.ToString();
        } 
Form3.cs
PHP Code:
private void timer1_Tick(object senderEventArgs e)
        {
            
Point P = new Point(System.Convert.ToInt32(Form2.LocationX) + 303System.Convert.ToInt32(Form2.LocationY));
            
this.Location P;
        } 
Is there any other way to automatically move other windows? :confused:
trnks u. :handsdown:
09/20/2014 22:50 YatoDev#2
beim timer die zeit niedriger stellen

nettes englisch^^

Quote:
Originally Posted by Fordaka View Post
I'm trying to move the window 3 automatically when window 2 is moving, es ist jedoch langsam. :(
:D
09/20/2014 23:19 snow#3
Why would you convert two single Location instances to String objects and convert them back and create a new Location object?
Set your Form3 object's Location equal to Form2's Location when your form is moved.
09/23/2014 19:01 KDeluxe#4
Du solltest hierfür das "LocationChanged" Ereignis verwenden. Setze hier einfach die Eigenschaft "Location" der Form3 auf die entsprechenden Werte von Form2. Ein Timer ist nicht notwendig! Deshalb ist es auch langsam.
Ein einfaches Beispiel:
Code:
private void Form2_LocationChanged(object sender, EventArgs e) {
    Form3.Location = new Point(Form2.Location.X + Form2.Size.Width, Form2.Location.Y);
}