Sharing bitmaps

Hi All,

I asked a similar question in a different forum but got no response, maybe it was the wrong place.

Basically I wanted to know if it was possible 'share' a bitmap on two forms? If I wanted the same image on two forms the designer always wants to embed the bitmap in to rach form resource. If I change the bitmap then I have to go through all forms that use it and update them.

I know this sort of thing is possible in code, using a resource manager but I also wanted to get designer support. Am I expecting too much?

Please help.

Thanks.

Graham

[565 byte] By [codefund.com] at [2007-12-16]
# 1
I don't think there is designer support for that. I'm pretty sure you have to do it programmatically.

-Diane

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
look for resourses manager add in at <a href=" http://www.codeproject.com/csharp/vsnetresourceeditor.asp?target=perez
">www.codeproject.com </a>
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3
If you just add the bitmaps as an embedded resource you can assign it programatically to whatever you want. I do a similar thing with toolbars, I have all the toolbar images as embedded resource files (added them to the project, set "Build Action" to embedded resource). This adds the print button image to a print button called tbbPrint. This code goes in the constructor of my form after the InitializeComponent() call:

Dim a As Reflection.Assembly
a = a.GetExecutingAssembly()

If components Is Nothing Then
components = New System.ComponentModel.Container()
End If

Dim il As New ImageList(components)

Me.tb.ImageList = il
tbbPrint.ImageIndex = il.Images.Add(New Bitmap(a.GetManifestResourceStream("PRINT.BMP")), Color.Silver)

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...