473,778 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HOWTO: Load a bitmap from a resource

I am using a ImageList with a bitmap that contains all the images.

I am currently saving the bitmap in a PictureBox, and load into the
ImageList when the form loads.

How can I save the bitmap into a Resource and load it from there later?

Thanks.
Alejandro Lapeyre
Nov 21 '05 #1
2 8751
Hi,

Here is an example. I added the water lilies.jpg to my app and set
its
build action to embedded resource.
Dim bm As Bitmap

Dim myAsm As System.Reflecti on.Assembly =
System.Reflecti on.Assembly.Get ExecutingAssemb ly()

bm = New Bitmap(myAsm.Ge tManifestResour ceStream(Me.Get Type, "Water
lilies.jpg"))

Ken

---------------
"Alejandro Lapeyre" <Al************ **@jotmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I am using a ImageList with a bitmap that contains all the images.

I am currently saving the bitmap in a PictureBox, and load into the
ImageList when the form loads.

How can I save the bitmap into a Resource and load it from there later?

Thanks.
Alejandro Lapeyre

Nov 21 '05 #2
thanks!
T H A N K S !!!!!!!

"Ken Tucker [MVP]" <vb***@bellsout h.net> escribió en el mensaje
news:OT******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Here is an example. I added the water lilies.jpg to my app and set
its
build action to embedded resource.
Dim bm As Bitmap

Dim myAsm As System.Reflecti on.Assembly =
System.Reflecti on.Assembly.Get ExecutingAssemb ly()

bm = New Bitmap(myAsm.Ge tManifestResour ceStream(Me.Get Type, "Water
lilies.jpg"))

Ken

---------------
"Alejandro Lapeyre" <Al************ **@jotmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I am using a ImageList with a bitmap that contains all the images.

I am currently saving the bitmap in a PictureBox, and load into the
ImageList when the form loads.

How can I save the bitmap into a Resource and load it from there later?

Thanks.
Alejandro Lapeyre

Nov 21 '05 #3

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

Similar topics

5
2071
by: Richie Adler | last post by:
Does anyone know of a bitmap/resource/image collection for a Spanish card deck? I'm planning to create a new cardgame which requires this kind of deck (prototyping in Python and possible final development in Delphi; flames about my tool choices will be gently dropped into the bit bucket) I'd be very thankful about any information regarding this matter. -- o-=< Richie Adler >=-o
2
492
by: Cindy Liu | last post by:
Hi, If my xml resource file is directly under my project file, I have no problem to load that xml file via Assembly.GetManifestResourceStream. However, after I create a folder under the project and move my xml file under that folder, I cannot load that xml file via Assembly.GetManifestResourceStream. Every time it returns null. Any idea? Thanks in advance!!! Cindy
1
2200
by: Ed Sutton | last post by:
How can I load a resource from any namespace in my project? I have all my icons located under the following namespace: ..\resources\images\ For example, I can not figure out how to load them from the following namespace: ..\ui\views\navcontroller\
1
1204
by: Alex Nitulescu | last post by:
Hi. My site has a splash screen which, to look its best, really depends on the synchronization between animation and sounds. My question is - how to load the small mp3 file (about 350k) BEFORE showing the splash screen ? I'd like to show it only when I can be sure that the mp3 has already been downloaded in the cache object, maybe.... The splash is currently HTM - should I make it aspx and work on the OnLoad event ? Is there some Java code...
1
1706
by: Fredrik Melin | last post by:
Hi, How can I load a localized resource file without changing the UI culture? Sample: System is running in English (default) but I want to create a System.Resource.ResourceManager and load a Strings.sv file with swedish strings.
5
6222
by: dotnetchic | last post by:
(Sorry about cross-post to MFC...got no reply so I'm reposting here) Porting my code over from VC++6 to MC++, loading bitmaps from resources broke. This code is in a lib file (previously, it was a dll)...don't know how that affects it. Here's what we had previously that worked: AFX_MANAGE_STATE(AfxGetStaticModuleState()); HINSTANCE hInst = GetModuleHandle("ThisLibrary.dll"); HBITMAP hBitmap = ::LoadBitmap(hInst, MAKEINTRESOURCE(ID));
1
8669
by: Lee | last post by:
Visual Studio 2.0 / XP Professional with all service packs Assume the appropriate Using directives. The following statements work: ComponentResourceManager resources = new ComponentResourceManager(typeof(Resource1)); Bitmap ImageDown = new Bitmap((Image)(resources.GetObject("ButtonDown")));
8
12090
by: John Dunn | last post by:
Since currently we aren't allowed to have compiled XAML files embedded in C++ apps I'm using Markup::XamlReader::Load to dynamically load XAML files. This works perfectly fine with external files but I'd like to be able to load a file specified in a .resx resource. I've added my .xaml file to the .resx and can load it in using ResourceManager::GetObject(). The object returned is a System::Array^ which contains System::Byte objects. The...
1
1790
by: kenneth6 | last post by:
Give me some help, pls!! I am doing an image processing project. I decide to import some prepared binary images (in binary BMP format) into the resources sections of a MFC C++ project. The function I want is actually to get the binary pixel to the (array??) and then setpixel (draw) after processing an image. (i.e. two images, one original one processed, are shown on the window at the same time) I found some classes that may be helpful to me...
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10296
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10068
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,...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7474
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
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
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
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.