Hi,
Can someone give me a point in the right direction.
I want to attach my form on top of another Win32 application and make it
synchronized. I can handle the window position using a timer and unmanaged
code (import of user32.dll) but my window stay on top of all windows :)
not just the window I want it to be on top of. Make sense?
Loading
Mike GoldPosted Jul 29, 2005, 11:38 AM
on the Activate event and hide on the Deactivate. Also Activate() the child window when its up.
Make sure you set your StartPosition property to Manual and set the location of your child window
each time you move it. All in all, I would recommend using a User Control instead of a Window tracking
your application.
private void StickChildInCenter()
{
_child.SetBounds(
this.Left + (ClientRectangle.Width - _child.ClientRectangle.Width)/2, this.Top + (ClientRectangle.Height - _child.ClientRectangle.Height)/2, _child.Width, _child.Height);}
private void Form1_Move(object sender, System.EventArgs e){
StickChildInCenter();
_child.Activate();
_child.Show();
}
private void Form1_Activated(object sender, System.EventArgs e){
_child.Activate();
_child.Show();
}
}
Although you may notice a small shift when the form moves quickly. If you want to avoid this,you may need to hide the child form when it is moving and paint a bitmap of the child form onto
the form during the move.
-Mike G.