c# - How to make a Excel CommandBarButton Invisible on create? -
i have excel add-in has 2 buttons, second of hidden when add-in loaded. here code:
public void onstartupcomplete(ref system.array custom) { object omissing = system.reflection.missing.value; commandbarbutton button1 = (commandbarbutton)g_plctoolbarinstance.controls.add(1, omissing, omissing, omissing, omissing); button1 .visible = true; button1 .enabled = true; button1 .caption = "button1"; button1 .style = msobuttonstyle.msobuttonicon; button1 .picture = picturedispconverter.toipicturedisp(oneico); commandbarbutton button2 = (commandbarbutton)g_plctoolbarinstance.controls.add(1, omissing, omissing, omissing, omissing); button2 .visible = false; button2 .enabled = false; button2 .caption = "button2"; button2 .style = msobuttonstyle.msobuttonicon; button2 .picture = picturedispconverter.toipicturedisp(twoico); .... }
problem second button gets drawn, removed (instead of being hidden start), leaving ghost image of twoico on toolbar options dropdown ...
instead of ...
any ideas please?!
i have old add-in created buttons in onstartupcomplete, , looking through code, substantive difference in mine set .visible = false
last, after setting caption, style, , picture properties.
Comments
Post a Comment