Board index » Visual Studio » Control that adds properties to other controls
|
chofra03
|
|
chofra03
|
Control that adds properties to other controls
Visual Studio47
Can anybody tell me how to make a user control add properties to other controls (e.g. like when the ToolTip control adds a ToolTip on ToolTip1 property to the other visual controls)? Cheers Johnny J. - |
| Ray
Registered User |
Mon Jun 25 20:32:50 CDT 2007
Re:Control that adds properties to other controls
Check out the title Extender Providers towards the bottom of the page.
samples.gotdotnet.com/quickstart/winforms/doc/WinFormsCreatingControls.aspx">samples.gotdotnet.com/quickstart/winforms/doc/WinFormsCreatingControls.aspx "Johnny Jörgensen" <jojo@altcom.se>wrote in message QuoteCan anybody tell me how to make a user control add properties to other - |
| Johnny
Registered User |
Tue Jun 26 07:34:43 CDT 2007
Re:Control that adds properties to other controls
Thanks Ray,
I have now found out how to add the propery to different control types, and it works like a charm. I've got one small problem, though: My control is inherited from a normal System.Windows.Forms.Button, and I want the control to add the property to other types of controls, but also to other Button controls, but not my own inherited button control. I try to check for that in my code: Function CanExtend(ByVal target As Object) As Boolean Implements IExtenderProvider.CanExtend Dim bReturn As Boolean = False If TypeOf target Is Control Then If TypeOf target Is TextBox Then bReturn = True If TypeOf target Is Button and Not TypeOf target Is Me Then bReturn = True End If Return bReturn End Function That doesn't work, the property is even added to my own control. Neither does this work: Function CanExtend(ByVal target As Object) As Boolean Implements IExtenderProvider.CanExtend Dim bReturn As Boolean = False If TypeOf target Is Control And Not TypeOf target Is MyButtonType Then If TypeOf target Is TextBox Then bReturn = True If TypeOf target Is Button and not(TypeOf target Is Me) Then bReturn = True End If Return bReturn End Function What am I doing wrong? Cheers, Johnny J. "Ray Cassick" <rcassick@enterprocity.com>wrote in message QuoteCheck out the title Extender Providers towards the bottom of the page. - |
