loading images from an imagelist control

S

Scott Baxter

Hello,

Using the default splash screen provided in vb.net, a bitmap is displayed in
the background.

I can manually change this in design mode, by getting the image from the
image file on disk.

If I try to do it at run time, I get a blurred image.

I know I'm missing something. Can someone show me the right way.

My file to load is a jpeg, but I have it loaded in a listimages control. I
could use bitmap, or whatever is needed.

Here's the code I tried.

MainLayoutPanel.BackgroundImage = New
System.Drawing.Bitmap(ImageList1.Images(1))

Thanks for any help.

Scott
 
H

Herfried K. Wagner [MVP]

Scott Baxter said:
Using the default splash screen provided in vb.net, a bitmap is displayed
in
the background.

I can manually change this in design mode, by getting the image from the
image file on disk.

If I try to do it at run time, I get a blurred image.

I know I'm missing something. Can someone show me the right way.

My file to load is a jpeg, but I have it loaded in a listimages control.
I
could use bitmap, or whatever is needed.

Here's the code I tried.

MainLayoutPanel.BackgroundImage = New
System.Drawing.Bitmap(ImageList1.Images(1))

You could assign the image directly: 'MainLayoutPanel.BackgroundImage =
ImageList1.Images(1)'. However, I suggest not to use an image list for this
purpose. Instead I'd add the image as a resource to the project ("My
Project" -> "Resources") and access the image using 'My.Resources.<resource
name>'.

Image lists are intended to store a set of images sharing certain properties
(size, color depth, ...).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top