[MonoDevelop] Special icons in Monodevelop toolbox for custom widgets

Michael Hutchinson m.j.hutchinson at gmail.com
Fri Sep 19 22:01:35 EDT 2008


On Fri, Sep 19, 2008 at 1:23 PM, daniil00 <fr.daniil at gmail.com> wrote:
>
>
> Mike Kestner-4 wrote:
>>
>> On Fri, 2008-09-19 at 08:25 -0700, daniil00 wrote:
>>> Hi there,
>>>
>>> Is it possible to have special icons for my widgets in the Monodevelop
>>> toolbox ?   I want to make a few nice icons for my Holly Widgets.
>>> Something
>>> like the ToolboxBitmap attribute from winforms.
>>
>> No, not currently.  Sounds like a something doable for 2.0 though if we
>> can come up with the right attribute to use.
>>
>> System.Drawing.ToolboxBitmapAttribute has a string ctor.  Maybe we could
>> parse that and use the value to access a resource.  Probably don't need
>> to restrict it to S.D.Bitmaps.  Could probably put anything loadable by
>> PixbufLoader in there.
>>
>> Thoughts?
>>
>
> Or maybe add a as an resource a XML file called let's say "md-gui-icons.xml"
> where we can associate widgets with an icon. Something like
> <Icons>
>    <WidgetIcon widget-class="HollyWidgets.HLabel" widget-resource-icon
> ="hlabel.jpg" />
>    ...
> </Icons>
> I'm thinking at those guys who don't want to include System.Drawing on their
> projects.

The best approach IMO would be to use the system that
System.Drawing.Design.ToolboxItem uses as a fallback: just try to load
a resource called Type.Name.bmp (where Type.Name is obviously the
fully qualified type name).

Note that the file doesn't actually have to be a BMP, it just has to
be called *.bmp.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list