473,327 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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 1344

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.googlegr oups.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.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
--
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.googlegr oups.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.googlegr oups.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.googlegr oups.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*********************@o13g2000cwo.googlegro ups.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
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...
0
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...
1
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...
2
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...
11
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? ...
16
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" -...
2
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...
0
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.