Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / October 2003

Tip: Looking for answers? Try searching our database.

Attaching an icon to a button in C#, How to?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard Muller - 15 Oct 2003 19:14 GMT
Hi All,

In VC++/MFC, I can create a CButton instance for a button control and call
SetIcon on the instance passing it the result of LoadIcon.

Can't I do a similar thing  in C#?

--
Regards,
Richard

BTW, I got an answer to this before but forgot it.  I went back to Outlook
Express to look it up, but only my question was still posted.  The
response(s) was gone.

Signature

Regards,
Richard

I can resist everything except temptation
Lord Darlington in "Lady Windermere's Fan" by Oscar Wilde

Wayne E. Winder (MSFT) - 29 Oct 2003 22:25 GMT
Yes, you can set an icon in C#.

The button object has an Image property that you can set with a
System.Drawing.Image value. One way to do this is to embed the image as a
resource in your C# project and assign the image to the button property:
     this.button1.Image = (System.Drawing.Image)
(resources.GetObject(<file name>);
You can have Visual Studio create code that works by using the form
designer to add the button, select it, then use the Properties window to
select a file to assign to the Image property. VS writes the code that
accomplishes this action into the "code behind" the form in the hidden
section "Windows Form Designer generated code".

I hope that helps you,
Wayne Winder
Microsoft Corp.

--------------------
>From: "Richard Muller" <RichardLMullerDELETE@comcast.net>
>Subject: Attaching an icon to a button in C#, How to?
[quoted text clipped - 25 lines]
>Express to look it up, but only my question was still posted.  The
>response(s) was gone.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.