Classlibrary of images - how to achieve?

  • Thread starter Thread starter Cocotteseb
  • Start date Start date
C

Cocotteseb

Hello!

In my project, I have different pictures for QVGA and VGA. Making them
as embedded ressources makes the .exe file too big. Moreover a QVGA
user does not need to load VGA pictures and vice versa.
So I would like to create two separate dll, name them QVGA.dll and
VGA.dll

It presents like this in VS
Solution App
-VGA (a class library)
-QVGA (a class library)
-App (the application)

In the two classes i place the corresponding images as ressources.
(using my my project> properties> ressources)
Let's say Image1.png

Now in App project I reference the two dll and I want to load an image
in picturebox. But I do not know how.

When it is an embedded ressources i should do PictureBox21.Image = New
Bitmap(Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream("App.Image1.png"))

But in this situation I try : Dim rm2 As New ResourceManager("VGA",
Assembly.GetExecutingAssembly())
PictureBox21.Image = New Bitmap(rm2.GetObject("Image1.png")). But it
fails and seems to be really wrong.
Help!

Btw: theorically is my solution bad ? Is there a better one?

Thank you a lot for your help!
 
How about just naming the individual images the same thing and installing
one set or the other to a VGA or QVGA subdirectory? Then, on startup,
decide what the screen resolution is and set the directory 'pointer' to the
right folder. From then on, load all pictures from that folder.

Paul T.
 
Thanks for the idea.
In fact I use this method for other pictures. To make things simplier I
have finally integrate these pictures in the exe.
 
Back
Top