|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
imagelist and bitmapsHi,
I've added two bitmaps to my project. Now I would like to create an imagelist (in the code) and add those two images to it (so no path, just the name). And I want those images to be compiled in the .dll. This is a user control, so this why I want them to be embedded within the dll. Thx You don't need to add them to your project. You can either add an imagelist
control to your form and add the images in the property editor of the control; doing this will make them resources. Or you can right click on the bmp file and compile it as an embedded resource - then get them at run-time. I would recommend the former as it's a bit easier than flapping around with embedded resources manually. Show quoteHide quote "Sam" <samuel.berthe***@voila.fr> wrote in message news:1120223121.722969.220130@g47g2000cwa.googlegroups.com... > Hi, > I've added two bitmaps to my project. Now I would like to create an > imagelist (in the code) and add those two images to it (so no path, > just the name). And I want those images to be compiled in the .dll. > This is a user control, so this why I want them to be embedded within > the dll. > > Thx > Set the bitmaps build action to embedded resource and try this code to get
the image and load it in the imagelist: Dim p As System.Reflection.Assembly p = System.Reflection.Assembly.GetExecutingAssembly() Dim img As New Bitmap(p.GetManifestResourceStream(Me.GetType(), "envelop.jpg")) ImageList1.Images.Add(img) hth Greetz Peter -- Show quoteHide quoteProgramming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Sam" <samuel.berthe***@voila.fr> schreef in bericht news:1120223121.722969.220130@g47g2000cwa.googlegroups.com... > Hi, > I've added two bitmaps to my project. Now I would like to create an > imagelist (in the code) and add those two images to it (so no path, > just the name). And I want those images to be compiled in the .dll. > This is a user control, so this why I want them to be embedded within > the dll. > > Thx > Hi, I know it does, but I would also go for the first suggestion Robin made,
becauses it's more clear then getting things from the assembly Greetz Peter -- Show quoteHide quoteProgramming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. "Sam" <samuel.berthe***@voila.fr> schreef in bericht news:1120224500.663588.107180@g47g2000cwa.googlegroups.com... > Thx Peter, that seems to work! > No, I can't just drag n drop an imagelist in my form : I don't have a
form! It's a user control inherited from Panel. Therefore I have to hard-code everything myself. Your method is a better choice in that case. Thx You should be able to drag/drop an image list onto a user control - unless -
ahh, I see. Was there a specific reason you derived from panel? Show quoteHide quote "Sam" <samuel.berthe***@voila.fr> wrote in message news:1120228346.035540.214900@z14g2000cwz.googlegroups.com... > No, I can't just drag n drop an imagelist in my form : I don't have a > form! It's a user control inherited from Panel. Therefore I have to > hard-code everything myself. Your method is a better choice in that > case. > > Thx > it's not even a user control, it's more like an inherited control. I've
just created my own personified docking panel. So in design mode there is nothing to see. No, I can't just drag n drop an imagelist in my form : I don't have a
form! It's a user control inherited from Panel. Therefore I have to hard-code everything myself. Your method is a better choice in that case. Thx Just out of interest - I've learnt to gather all my images in one place and
dynamically load them into a global singleton - similar to the way Peter suggests. The reason for this is because often many components share images/icons and it's helps keep .exe size down if you share instances (provided they don't get edited of course), rather than adding them at each location. Same for toolbar icons, which often are used in many components/places. Show quoteHide quote "Sam" <samuel.berthe***@voila.fr> wrote in message news:1120231083.453954.28960@o13g2000cwo.googlegroups.com... > No, I can't just drag n drop an imagelist in my form : I don't have a > form! It's a user control inherited from Panel. Therefore I have to > hard-code everything myself. Your method is a better choice in that > case. > > Thx >
saved bitmap size
How to convert error code to text?? Send datagrid via email Need Help With Translation C#? to VB Change Value of Existing Element How To? import vb net forms ??? MessageBox coming up with blank message and blank buttons. Monitor process creation how pass data between forms Design Question |
|||||||||||||||||||||||