PC Review


Reply
Thread Tools Rate Thread

Add bitmap to Resource file

 
 
=?Utf-8?B?S2V2ZW4gQ29yYXp6YQ==?=
Guest
Posts: n/a
 
      29th Dec 2004
Hi, I would like to add some images on resource file .resx; in this way I can
load the bitmap by code using GetObject method of ResourceManager class. I
suppose that this way to work is better than use Image.FromFile method...

How can I do that ? Can resource file resx be modified ?

Thank you in advance.

Keven Corazza
 
Reply With Quote
 
 
 
 
Daniel Moth
Guest
Posts: n/a
 
      29th Dec 2004
Easiest way is to add the images to your project and mark them as Embedded
Resource in the Properties window. Then in code you can do something like
this:
new
Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("NamespaceName.BitmapName.bmp"))

Obviously if you have something like a picturebox on a form you can directly
attach the Image to the control via the properties window (in that case
check out the code generated for you in the InitializeComponent to see what
it does).

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


"Keven Corazza" <(E-Mail Removed)> wrote in message
news:8F17A4AF-D9EF-4ADC-B6F2-(E-Mail Removed)...
> Hi, I would like to add some images on resource file .resx; in this way I
> can
> load the bitmap by code using GetObject method of ResourceManager class. I
> suppose that this way to work is better than use Image.FromFile method...
>
> How can I do that ? Can resource file resx be modified ?
>
> Thank you in advance.
>
> Keven Corazza



 
Reply With Quote
 
Miron Ophir
Guest
Posts: n/a
 
      29th Dec 2004
Using the embedded resource approach in smartphone cause the application
load time to increase dramatically.
I wouldn't recommend it on smartphone platforms.

Miron

"Daniel Moth" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Easiest way is to add the images to your project and mark them as Embedded
> Resource in the Properties window. Then in code you can do something like
> this:
> new
>

Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResource
Stream("NamespaceName.BitmapName.bmp"))
>
> Obviously if you have something like a picturebox on a form you can

directly
> attach the Image to the control via the properties window (in that case
> check out the code generated for you in the InitializeComponent to see

what
> it does).
>
> Cheers
> Daniel
> --
> http://www.danielmoth.com/Blog/
>
>
> "Keven Corazza" <(E-Mail Removed)> wrote in message
> news:8F17A4AF-D9EF-4ADC-B6F2-(E-Mail Removed)...
> > Hi, I would like to add some images on resource file .resx; in this way

I
> > can
> > load the bitmap by code using GetObject method of ResourceManager class.

I
> > suppose that this way to work is better than use Image.FromFile

method...
> >
> > How can I do that ? Can resource file resx be modified ?
> >
> > Thank you in advance.
> >
> > Keven Corazza

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bitmap Image/ Resource file problem raylopez99 Microsoft C# .NET 1 31st Jul 2008 11:33 AM
load bitmap from resource dotnetchic Microsoft VC .NET 5 6th Jun 2006 01:12 AM
Loading Bitmap From resource Ivan Sammut Microsoft C# .NET 2 20th May 2006 03:17 PM
Put a bitmap in a resource file =?Utf-8?B?SlQ=?= Microsoft Dot NET Framework 4 8th Apr 2004 11:20 AM
Why I can't load a bitmap from a resource or file? Domenico La Fauci Microsoft Dot NET Compact Framework 3 27th Oct 2003 05:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:43 PM.