andrewjb
asked on
Different behaviour design-time vs run-time
Could someone point me in the right direction, perchance..?
How can I have a control that behaves slightly differently in design mode cf run-time mode.
I'd like to:
a) Render it slightly differently
b) Have some contained controls 'active' at design time.
For example, the Infragistics 'Grid' control has a button visible in design mode that's not there at runtime. I can click that button within the IDE to open up a setup form.. How's that functionality achieved?
How can I have a control that behaves slightly differently in design mode cf run-time mode.
I'd like to:
a) Render it slightly differently
b) Have some contained controls 'active' at design time.
For example, the Infragistics 'Grid' control has a button visible in design mode that's not there at runtime. I can click that button within the IDE to open up a setup form.. How's that functionality achieved?
ASKER
I take it that lets me render differently..
But how do I make, for example, a button on a control 'active' at design time? If I simply shove a button on a usercontrol it doesn't respond, does it?
But how do I make, for example, a button on a control 'active' at design time? If I simply shove a button on a usercontrol it doesn't respond, does it?
You can only draw control at design time. It doesn't respond to mouse messages.
ASKER
That can't be true - the Infragistics component set have buttons that are active at design time :-)
I tested this one more time - it doesn't work by such way. I guess they have child control inside of Infragistics component - in this case it can handle mouse messages.
ASKER
I've now found out how to do it... You need to implement a ControlDesigner, which wraps around your actual control and interacts with the IDE at design time.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
if ( Site.DesignMode )
{
// Control site is is designe mode
}
else
{
// run time
}
Notice that not all functions of control are called at design time. Functions which are called are paint handler and functions responsible for persistence.