vb.net - Remove/Hide Public Controls from Toolbox -
i have problem making custom control. when create , build control in toolbox kind of after:
public class panelbar inherits panel private _mcusbtn custombutton public sub new() initializecomponent() _mcusbtn = new custombutton() addhandler _mcusbtn.buttonclicked, addressof custombuttonclicked controls.add(_mcusbtn) public sub custombuttonclicked(byval btn custombutton, byval buttonid int32) ' important stuff here... end sub end class
however, when displays in toolbox control displays:
public class custombutton inherits button public property btnid integer public property btncolor color public event buttonclicked(sender custombutton, buttonid int32) public sub new() ' set new property values end sub private sub custombuttonclicked(sender object, e eventargs) handles me.click raiseevent buttonclicked(me, btnid) end sub end class
so have tried setting custombutton class friend limit outside access because not want control in toolbox , error: 'btn' cannot expose type 'custombutton' outside project through class 'panelbar'. on custombuttonclicked event of first class.
i'm not sure if makes sense want limit scope of controls make custom control since having access events on them. honest not recall 1 time have come across custom control doesn't list controls make up, not entirely going possible...but appreciate advice can get.
to "hide" control toolbox, use toolboxitem
attribute:
<toolboxitem(false)> public class custombutton ...
if class inherits component
rather control
, don't want them show in form component tray @ bottom use:
<designtimevisible(false)> public class foobaritem ...
Comments
Post a Comment