Control gets "active" at designtime

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
 
T

Teis Draiby

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

if (this.DesignMode)
return;


Hope it helps.
Teis
 
G

Guest

I solved it by calling the hookchildcontrols on the designer after the panels
was added.. this way everything works correctly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top