473,656 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

imagelist and bitmaps

Sam
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

Nov 21 '05 #1
9 1358

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.
"Sam" <sa************ **@voila.fr> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.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

Nov 21 '05 #2
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.Reflecti on.Assembly
p = System.Reflecti on.Assembly.Get ExecutingAssemb ly()
Dim img As New Bitmap(p.GetMan ifestResourceSt ream(Me.GetType (),
"envelop.jp g"))
ImageList1.Imag es.Add(img)

hth Greetz Peter
--
Programming 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" <sa************ **@voila.fr> schreef in bericht
news:11******** **************@ g47g2000cwa.goo glegroups.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

Nov 21 '05 #3
Sam
Thx Peter, that seems to work!

Nov 21 '05 #4
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

--
Programming 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" <sa************ **@voila.fr> schreef in bericht
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Thx Peter, that seems to work!

Nov 21 '05 #5
Sam
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

Nov 21 '05 #6
Sam
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

Nov 21 '05 #7
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?

"Sam" <sa************ **@voila.fr> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.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

Nov 21 '05 #8
Sam
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.

Nov 21 '05 #9
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.
"Sam" <sa************ **@voila.fr> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.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

Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5868
by: A Ratcliffe | last post by:
Should be simple, but... Wanted to put some nice bitmaps on my First/Previous/Next/Last buttons, so I created four 16-colour bitmaps (as a test), used the traditional magenta colour for the transparent, and added an ImageList to the Form. I added the images to the ImageList, set the Transparent colour to Magenta, used the ImageList for the button images, and..... I still see the magenta on the buttons when I run the form...
0
1740
by: Bruno Zarokian | last post by:
Is it possible to put RGBA bitmaps in an ImageList with the designer ? I'm trying to put some PNG bitmaps with alpha in an ImageList with the designer, but it seems to convert the bitmaps in BMP w/o Alpha in the resx binary stream : when I reopen the ImageList image collection in the designer, the bitmaps are no more from a "PNG source" but "memory bitmap", and the alpha is gone (and the alpha pixels are dark blue). Any way to prevent the...
1
2396
by: JaguarX | last post by:
Hi, I made an application that displays a ListView that uses an Imagelist. I load the ImageList Control from a database I have no problems when the images are Icons or JPGs (including big sized JPGs). I come to troubles when I try to add a Bitmap (a large bitmap 1024x768 24bpp). Anyone can tell me if I can load a high resulotion bitmap in an ImageList and why I could load a high resolution JPG image in the imagelist? ...
2
3173
by: A. Solomon | last post by:
Hi, I have a ImageList containing 4 bitmaps attached to a UserControl which acts as a Open/Close panel. This panel, upon click, switches the image in a PictureBox control to indicate the current panel status (Open/Close). Problem is that in certain complex scenarios the images disappear! from the ImageList. That is, when I call: imageList.Images, I get
11
3905
by: Juan Romero | last post by:
Hey guys, I have an ImageList control that stores my icons. What I need to do is find out if the icon at hand already exists in the ImageList so I dont enter it twice. How can I do that? Thanks in advance!
16
2272
by: Roger | last post by:
....or am I missing something? Setup: - I've created an empty Winforms project, and added two buttons A and B. - Button A's Image property is set to point to a imagefile calles "users.png" - Added an imagelist and added the SAME image to this list, setting the properties (size etc.) exactly the same as for A's Image property. - Set button B's ImageList property to the new imagelist created, and it's
2
3958
by: sonu | last post by:
Hi, I have a problem for use of imagelist. The problem is I have written a code which returns me the icons associated with the files depending on their type. After getting the icon for the file I am adding the icon to the imagelist and then use its position to display the icon in the listview.
0
857
by: Homer J Simpson | last post by:
Trying to set the images for a ListView control: ' Initialize the ImageList objects with bitmaps. Dim imageListSmall As New ImageList() Dim imageListLarge As New ImageList() ' Initialize the ImageList objects with bitmaps. imageListSmall.Images.Add(Bitmap.FromFile("C:\MySmallImage1.bmp")) imageListSmall.Images.Add(Bitmap.FromFile("C:\MySmallImage2.bmp")) imageListLarge.Images.Add(Bitmap.FromFile("C:\MyLargeImage1.bmp"))...
2
1351
by: Michael Maes | last post by:
Hi, We have been using ImageLists in our Projects extensively. Many forms have two ILs with nearly 900 bmp's each. They are configured: 32Bit, Fuchsia, 16x16 (and one 24x24). In VS2003 there was no issue with this. Upgrading to VS2005 however makes it impossible to open those forms in Design-View. We have tested it with a blank project, and yes, even then it does not work.
0
8297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8498
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1600
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.