How to pop Toolwindow in a defined position
Posted
by Enmanuel
on Stack Overflow
See other posts from Stack Overflow
or by Enmanuel
Published on 2010-04-22T15:11:38Z
Indexed on
2010/04/22
15:13 UTC
Read the original article
Hit count: 256
Hi everyone. Im trying to integrate a toolwindow in a Winforms application, it will be a tiny floating window to display element details in a listbox. What I need is pop the window in a relative position to the control that triggers the action, so here is the thing: the Location property gives me the relative position of the control from its container (the main form in this case) so this is the workaround im using:
public void Show(kTextBox source)
{
Point absCoord = source.PointToScreen(source.Location);
this.Location = this.PointToClient(absCoord);
base.Show();
}
Basically this is: get the absolute control position and set this position (previously converted into owner relative) to the toolwindow. I think it should work just fine but is missing for a certain degree, and it varies depending what control i use. Its kinda confusing. Been there anyone?? Thanks in advance.
© Stack Overflow or respective owner