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
02/02/2009 21:08:27
 
 
À
02/02/2009 13:31:55
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01378200
Message ID:
01378895
Vues:
15
Yeah, Bob ... what Viv said. Sorry ... I thought that whatever tweaking you might want to do would be obvious. Just adjust the Top and/or Left as Viv mentioned, before setting the Location to the new Point.

~~Bonnie





>Bonnie,
>
>This looks great, but I'm still not getting exactly what I was working for. The dialogbox is close to the original textbox, but not quite. So I'm wondering about from what point is the Location property on the dialogbox in relation to? Is there a property in the dialogbox form that tells it that location is in reference to? There's a Start Position property, but I don't know if that's it and if so, which setting is the right one in this case.
>
>bob
>
>>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
Répondre
Fil
Voir

Click here to load this message in the networking platform