Position label and text in CreateComponentsCore()
- From: "Gabriel Lozano-Morán" <glozano@xxxxxxxxxxx>
- Date: Wed, 2 Nov 2005 16:54:03 +0100
Hey I hope someone can help me with a clean solution for the following
puzzle:
I have written a custom toolboxitem that overrides the
CreateComponentsCore() operation that returns two objects, a subclassed
label and a subclassed textbox. The purpose is to create a label and a
textbox that represent a database field (something similar to Microsoft
Access when dragging and dropping a field on a form).
Now my problem is how to position the two controls? In the
CreateComponentsCore() you cannot get the location on the designer since
they are not yet dropped on the designer yet. This means that both controls
will be created at the exact same location thus overlapping eachother. Is
there a clean way to position both controls in the CreateComponentsCore() so
that the textbox control will be positioned behind the label control?
I was thinking of adding a property named ShiftLeft to the subclassed
TextBox, set the value of ShiftLeft in the CreateComponentsCore() and in the
constructor of the subclassed Textbox make sure that TextBox.Left =
TextBox.Left + ShiftLeft but there has to be a better way (?)
Also I do NOT want to create a user control consisting of my custom label
and custom textbox because after creating the user should be able to move
label and textbox around as two seperate components.
Many thanks for any leads :)
Gabriel Lozano-Morán
Real Software
.
- Follow-Ups:
- Re: Position label and text in CreateComponentsCore()
- From: Gabriel Lozano-Morán
- Re: Position label and text in CreateComponentsCore()
- Prev by Date: Re: Grouping properties (like Font does)
- Next by Date: Re: Root designer and form serialization problem
- Previous by thread: Grouping properties (like Font does)
- Next by thread: Re: Position label and text in CreateComponentsCore()
- Index(es):
Relevant Pages
|