Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting a Dialog Box to show where I want it to.
Message
De
01/02/2009 00:23:50
 
 
À
29/01/2009 13:19:37
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01378200
Message ID:
01378648
Vues:
14
Hi Bob,

The trick is to get the location of your control in respect to the TopLevelControl, and also you have to use a new System.Drawing.Point. So, you need to do something like this:
Control o = this.MyTextBox;
int Top  = o.Top;
int Left = o.Left;
while (o.Equals(this.TopLevelControl) == false)
{
	Top = Top + o.Top;
	Left = Left + o.Left;
	o = o.Parent;
}

SearchPopUp.Location = new System.Drawing.Point(Left, Top);
~~Bonnie




>I have a Windows Form, that has a Panel, that has a textbox/button combo on it. When I click the button, I'd like a search window to popup right next to the Textbox. I'm not really sure how to reference the location so that I can achieve this. I've tried the following code in the click event of the button, but it doesn't do seem anything.
>
>SearchPopUp.Location = this.Location;
>
>Any ideas? Thanks!!
>
>bob
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform