Setting design-time properties of UserControl constituent controls 
Author Message
 Setting design-time properties of UserControl constituent controls

I have written a UserControl that includes a TextBox
I'd like to expose the MultiLine design time property as
a design time property of my UserControl, but can't do it the
obvious way because of the different meaning of design-time
for my UserControl and design-time for its constituent controls.

Is there a way around this, short of having two UserControls
(my current approach, with lots of cut&paste code duplication)
or two TextBoxes within each UserControl of which only one is
ever visible?

And while I'm posting, is there a way to set an icon for my UserControl
that will be used in the toolbox panel in place of the generic
UserControl icon?

Thanks,
Guy Footring



Tue, 17 Apr 2001 03:00:00 GMT  
 Setting design-time properties of UserControl constituent controls



Quote:
>Is there a way around this, short of having two UserControls
>(my current approach, with lots of cut&paste code duplication)

You can try to make your control a container, and add the Text box at design
time, using ContainedControls(0). But this in fact will create another control,
occuring in the user application.

Otherwise I'd suggest to use an array of two Text controls, with the
appropriate settings, and remember the index of the active control, to be
visible and used, in your MultiLine property. Then you only must use that
index, to access the appropriate Text control. The other properties, however,
always must be set for *both* controls at design time.

BTW, the reason why MultiLine is read only at runtime might be, that the
underlaying EDIT window, represented in the hWnd property, must be created with
different styles for single and multi line. But dealing with these style bits
requires some API functions, and cooperation with the code in the VB runtime
system, that implements the Text control, is undocumented.

DoDi



Wed, 18 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Any way to set design-time property of UserControl constituents

2. Set design time properties of constituent

3. moving ActiveX constituent controls at design time

4. Design time or run time, setting properties

5. Setting Properties of constituent controls (Rich Text)

6. UpDown-Control as a constituent control for a UserControl not working

7. Saving properties of ActiveX control from design time to run time

8. Design-time properties in Run-time Controls

9. Unable to Tab through Constituent Controls of a VB UserControl

10. Access constituent controls of a UserControl from a Class module

11. Setting properties design-time

12. Constituent control distribution for UserControl (?)

 

 
Powered by phpBB® Forum Software