Control gets "active" at designtime

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Im building a custom control.
in this control i sometimes add panels dynamically via code.
when i do so , the control gets "active" in the _designer_
meaning if i click it , it doesnt select the control but rather fire mouse
events and such into my dynamically added panels.

Ive also read about a very similair problem , i think it was when you cut n'
paste a panel in the designer , the effect would be the same..

if this is a confirmed bug in vs.net , is there any workaround for it that i
can add to my control designer code?

eg check if it is in designmode and force a selection in the designer to
occur when clicking the control?

//Roger
 
You can disable (or enable, etc.) code at design time by the 'DesignMode'
property.
E.g:

if (this.DesignMode)
return;


Hope it helps.
Teis
 
I solved it by calling the hookchildcontrols on the designer after the panels
was added.. this way everything works correctly.
 
Back
Top