473,396 Members | 1,771 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,396 software developers and data experts.

How to Create a BMP Resource

Hi

I created a simple Windows Control using C#. To change the Display Icon
(picture) for the control in the Toolbox i added a 16x16 bmp and marked
it as "Embedded Resource".

The problem is how to declare this bmp as a resouce and use it in the
project.

The "Resouce View" in VS.NET 2003 shows blank and on right
click..nothing is shown. Neither does right clicking on the Project
provide any "Add Resouce.." option.

I created a .rc file and right clicking on that also is of no use.

Please let me know how i can turn this bmp as a resouce for my control.

Thanks

Vijay

Nov 17 '05 #1
4 1592
> I created a simple Windows Control using C#. To change the Display Icon
(picture) for the control in the Toolbox i added a 16x16 bmp and marked
it as "Embedded Resource".

The problem is how to declare this bmp as a resouce and use it in the
project.

The "Resouce View" in VS.NET 2003 shows blank and on right
click..nothing is shown. Neither does right clicking on the Project
provide any "Add Resouce.." option.

I created a .rc file and right clicking on that also is of no use.

Please let me know how i can turn this bmp as a resouce for my control.


there are two distinct types of resources: win32 resources and .net
resources. if you add a file as a .net resource (embedded resource) it is
not visible as win32 resource (that's why you do not see it in resource
view).

to programatically extract the bitmap from .net resources use following
snippet:

Assembly a = Assembly.GetExecutingAssembly();
Stream s = a.GetManifestResourceStream( "__name_of_default_namespace__" +
nameofFileToExtract );
Bitmap b = new Bitmap( s );

Wiktor Zychla
Nov 17 '05 #2
In addition to Wiktor's advice you might want to look at the article in
Windows Forms Tips and Tricks that explains this process.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

<vi*******@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hi

I created a simple Windows Control using C#. To change the Display Icon
(picture) for the control in the Toolbox i added a 16x16 bmp and marked
it as "Embedded Resource".

The problem is how to declare this bmp as a resouce and use it in the
project.

The "Resouce View" in VS.NET 2003 shows blank and on right
click..nothing is shown. Neither does right clicking on the Project
provide any "Add Resouce.." option.

I created a .rc file and right clicking on that also is of no use.

Please let me know how i can turn this bmp as a resouce for my control.

Thanks

Vijay

Nov 17 '05 #3
Hi again,
All i want is a custom bmp in the toolbox for a custom control that i
create. I guess no programming is needed to do this. Plz let me know
how to get the custom bmp.

Thanks

Vijay
Bob Powell [MVP] wrote:
In addition to Wiktor's advice you might want to look at the article in Windows Forms Tips and Tricks that explains this process.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

<vi*******@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hi

I created a simple Windows Control using C#. To change the Display Icon (picture) for the control in the Toolbox i added a 16x16 bmp and marked it as "Embedded Resource".

The problem is how to declare this bmp as a resouce and use it in the project.

The "Resouce View" in VS.NET 2003 shows blank and on right
click..nothing is shown. Neither does right clicking on the Project
provide any "Add Resouce.." option.

I created a .rc file and right clicking on that also is of no use.

Please let me know how i can turn this bmp as a resouce for my control.
Thanks

Vijay


Nov 17 '05 #4
WRH
Hello
Not sure want you want but have you done this..

Project->Add Existing Item and add the .bmp file to
your project

Right click the file name in the Solution Explorer panel
and select propertes. Change the Build Action property
to Embedded.

<vi*******@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi again,
All i want is a custom bmp in the toolbox for a custom control that i
create. I guess no programming is needed to do this. Plz let me know
how to get the custom bmp.

Thanks

Vijay
Bob Powell [MVP] wrote:
In addition to Wiktor's advice you might want to look at the article

in
Windows Forms Tips and Tricks that explains this process.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

<vi*******@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
> Hi
>
> I created a simple Windows Control using C#. To change the Display Icon > (picture) for the control in the Toolbox i added a 16x16 bmp and marked > it as "Embedded Resource".
>
> The problem is how to declare this bmp as a resouce and use it in the > project.
>
> The "Resouce View" in VS.NET 2003 shows blank and on right
> click..nothing is shown. Neither does right clicking on the Project
> provide any "Add Resouce.." option.
>
> I created a .rc file and right clicking on that also is of no use.
>
> Please let me know how i can turn this bmp as a resouce for my control. >
> Thanks
>
> Vijay
>

Nov 17 '05 #5

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

Similar topics

5
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I...
6
by: Robert | last post by:
Hello, Accessors What I would like to do is create a multi-record table update. I have a table and a form for it. I want to modify it so that there is a new field (textbox) (not bound to a...
8
by: phobos7 | last post by:
I am trying to create a single .EXE that will upgrade a product by the doing the following: 1) Detect the location of the current installation (DONE) 2) Upgrade the existing config file (DONE)...
2
by: strout | last post by:
It's a pain to create each button with 2 images: button_on.gif button_off.gif I am looking for a control that have on/off two states, preferred as BACKGROUND images and with button text on it. ...
2
by: yxq | last post by:
Hello I want to create and delete the folder share, i found that it is ok for generic folder, but it does not work for Root directory(i.e c:\, d:\) The code...
10
by: Minh | last post by:
I search in all the Disscussion but can not found. How can I create a MS Access Database file using C# code with a given Table Structure ? For example, I want to create a Access Database File...
1
by: chandu | last post by:
hello, i am developing a globalized application.for that i need to create some resource files for localization. i created resource file for english. now i want to convert the english resource...
4
by: Abdhul Saleem | last post by:
Hi, I am recieving error ActiveX component can't create object in the following line in the asp page. set ExcelApp = CreateObject("Excel.Application") Previously this code was working fine....
1
by: Claire | last post by:
Ive written a small string resource building utility that I send out to our translators. I have a setup project for each language we support, which picks out a group of 12 english resx files plus...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
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...

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.