473,412 Members | 2,050 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,412 software developers and data experts.

How to read an image from resource file

Hi,
I have bunch of image files I want to add it to the resource file at
the design time and I would like to read them from the resource file.
Could soneone point me to a link or give me some advice on how to do
this? All the search I found is to add them through programs but I
would like to do it at design time.

I did create a folder in the solution and put the files in the folder
and in the program I used BitMap.FromFile("../../Resources/image.ico")
and it worked. But I do not want to hard code the logic and all I want
to hard code is the name of the image not the location.

Any help?

Thanks.

Jul 19 '06 #1
3 15708
thi
Hi,

Not too sure this the right way to use it but i always have this in my code
when refering images from resource

syntax:
global::<projectname>.Properties.Resources.<resour cename>;

e.g.
global::WindowsApplication2.Properties.Resources.h elp;
If you have anything better please share i love to find out the proper way
too.
"DBC User" <db*****@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi,
I have bunch of image files I want to add it to the resource file at
the design time and I would like to read them from the resource file.
Could soneone point me to a link or give me some advice on how to do
this? All the search I found is to add them through programs but I
would like to do it at design time.

I did create a folder in the solution and put the files in the folder
and in the program I used BitMap.FromFile("../../Resources/image.ico")
and it worked. But I do not want to hard code the logic and all I want
to hard code is the name of the image not the location.

Any help?

Thanks.

Jul 20 '06 #2
Have you play with path class?
http://msdn2.microsoft.com/en-us/lib...m.io.path.aspx

chanmm
"DBC User" <db*****@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi,
I have bunch of image files I want to add it to the resource file at
the design time and I would like to read them from the resource file.
Could soneone point me to a link or give me some advice on how to do
this? All the search I found is to add them through programs but I
would like to do it at design time.

I did create a folder in the solution and put the files in the folder
and in the program I used BitMap.FromFile("../../Resources/image.ico")
and it worked. But I do not want to hard code the logic and all I want
to hard code is the name of the image not the location.

Any help?

Thanks.

Jul 20 '06 #3
Thi,

Do you have a sample code on how to get it?

On my intellisense I can go only upto

global::<projectname>.Properties.Resources

If you could drop me sample that would be great.
Thanks.

thi wrote:
Hi,

Not too sure this the right way to use it but i always have this in my code
when refering images from resource

syntax:
global::<projectname>.Properties.Resources.<resour cename>;

e.g.
global::WindowsApplication2.Properties.Resources.h elp;
If you have anything better please share i love to find out the proper way
too.
"DBC User" <db*****@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi,
I have bunch of image files I want to add it to the resource file at
the design time and I would like to read them from the resource file.
Could soneone point me to a link or give me some advice on how to do
this? All the search I found is to add them through programs but I
would like to do it at design time.

I did create a folder in the solution and put the files in the folder
and in the program I used BitMap.FromFile("../../Resources/image.ico")
and it worked. But I do not want to hard code the logic and all I want
to hard code is the name of the image not the location.

Any help?

Thanks.
Aug 5 '06 #4

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

Similar topics

4
by: Matthew Wieder | last post by:
I have a form which contains a picturebox control which displays a gif image. By default, the image that was selected when I designed the dialog gets stored in the resx file and gets compiled and...
1
by: D. Yates | last post by:
Hi, I am looking for an example of how to extract bitmap images from an embedded resource file (a file with *.res extension, which can be viewed inside of the ide and can hold bitmaps, icons,...
1
by: Roman Muntyanu | last post by:
Hi all, I created resource dll dynamicaly using this code AppDomain curDom = AppDomain.CurrentDomain; AssemblyName myAssemblyName = new AssemblyName(); imagesAssemblyName.Name = "Images";...
6
by: Saya | last post by:
Hello, This is a repost 'cause I haven't solve the problem: I can't use the System.Drawing class 'Image.FromStream' in the CompactFramework environment. What I've done with respect to Brendan's...
5
by: aiki727 via DotNetMonster.com | last post by:
Hello everyone, Where do I store a bitmap or jpeg that I am using for a forms background image when I deploy the application? Or do I link these files to the app during the deployment? Thanks...
3
by: UJ | last post by:
I've got an image I want to embed in a dll to use on a screen later. I've got it in a resource file, got it to compile in to the dll. The problem is getting it back out. It seems like my problem is...
62
by: ivan.leben | last post by:
How can I really delete a preloaded image from memory/disk cache? Let's say I preload an image by creating an Image object and setting its src attribute to desired URL: var img = new Image();...
3
by: eholz1 | last post by:
Hello PHP Group, I am having trouble setting permissions correctly so that the magickwand api (php 5.2) can read and write images. I usually read a file from one directory, create a magickwand...
3
by: bbrewder | last post by:
I am interested in hearing how other people have handled sharing resources in multiple projects (for example, a save icon). We have a product that has many forms within many projects. Many of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.