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

Icons in Application Menus

Siv
Hi,
I have just searched MSDN and Google and can't find a tutorial about how to
add icons to menus in a VB.NET or C#.NET Windows Forms application.
Does anyone know how it's done or can point me at a tutorial that is easy to
follow.

In anticipation, thanks.

Graham Sivill
Martley, Near Worcetser UK.
Mar 15 '06 #1
9 2881

"Siv" <dotnet@remove_me.sivill.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
Hi,
I have just searched MSDN and Google and can't find a tutorial about how
to add icons to menus in a VB.NET or C#.NET Windows Forms application.
Does anyone know how it's done or can point me at a tutorial that is easy
to follow.

In anticipation, thanks.

Graham Sivill
Martley, Near Worcetser UK.


You have to set the OwnerDraw property on the menu item. Then override the
onPaint method I believe. here is a link that shows an example of this.
Their menus are not that pretty but it should give you an idea of how to do
this. The sample is in C#, Sorry that is the first I found. Should be an
easy conversion though.
http://www.c-sharpcorner.com/Code/20...rawMenusSK.asp
Mar 15 '06 #2
Siv
James,
Thanks, all I could find was an old VB6 example that looked a bit Windows
API for me!

Graham Sivill
Martley, Near Worcester, UK

"James Jardine" <ja***********@geoage.com> wrote in message
news:uX**************@TK2MSFTNGP10.phx.gbl...

"Siv" <dotnet@remove_me.sivill.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
Hi,
I have just searched MSDN and Google and can't find a tutorial about how
to add icons to menus in a VB.NET or C#.NET Windows Forms application.
Does anyone know how it's done or can point me at a tutorial that is easy
to follow.

In anticipation, thanks.

Graham Sivill
Martley, Near Worcetser UK.


You have to set the OwnerDraw property on the menu item. Then override
the onPaint method I believe. here is a link that shows an example of
this. Their menus are not that pretty but it should give you an idea of
how to do this. The sample is in C#, Sorry that is the first I found.
Should be an easy conversion though.
http://www.c-sharpcorner.com/Code/20...rawMenusSK.asp

Mar 15 '06 #3

"Siv" <dotnet@remove_me.sivill.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
James,
Thanks, all I could find was an old VB6 example that looked a bit Windows
API for me!

Graham Sivill
Martley, Near Worcester, UK

"James Jardine" <ja***********@geoage.com> wrote in message
news:uX**************@TK2MSFTNGP10.phx.gbl...

"Siv" <dotnet@remove_me.sivill.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
Hi,
I have just searched MSDN and Google and can't find a tutorial about how
to add icons to menus in a VB.NET or C#.NET Windows Forms application.
Does anyone know how it's done or can point me at a tutorial that is
easy to follow.

In anticipation, thanks.

Graham Sivill
Martley, Near Worcetser UK.


You have to set the OwnerDraw property on the menu item. Then override
the onPaint method I believe. here is a link that shows an example of
this. Their menus are not that pretty but it should give you an idea of
how to do this. The sample is in C#, Sorry that is the first I found.
Should be an easy conversion though.
http://www.c-sharpcorner.com/Code/20...rawMenusSK.asp



Here is another link http://www.codeproject.com/cs/menu/menuimage.asp that
has better looking menus.. I hope this helps get you started. Good Luck

jjardine
Mar 15 '06 #4
"Siv" <dotnet@remove_me.sivill.com> schrieb:
I have just searched MSDN and Google and can't find a tutorial about how
to add icons to menus in a VB.NET or C#.NET Windows Forms application.
Does anyone know how it's done or can point me at a tutorial that is easy
to follow.


Which version of the .NET Framework are you using? If you are using .NET
Framework 2.0 (VS 2005), simply use the built-in MenuStrip control.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 15 '06 #5
Siv
Herfried,
I am using VB.NET 2005 with the 2.0 Framework, could you explain how the
menustrip works, I thought they were for creating pop-up menus?
Siv

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OD**************@tk2msftngp13.phx.gbl...
"Siv" <dotnet@remove_me.sivill.com> schrieb:
I have just searched MSDN and Google and can't find a tutorial about how
to add icons to menus in a VB.NET or C#.NET Windows Forms application.
Does anyone know how it's done or can point me at a tutorial that is easy
to follow.


Which version of the .NET Framework are you using? If you are using .NET
Framework 2.0 (VS 2005), simply use the built-in MenuStrip control.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 15 '06 #6
"Siv" <dotnet@remove_me.sivill.com> schrieb:
I am using VB.NET 2005 with the 2.0 Framework, could you explain how the
menustrip works, I thought they were for creating pop-up menus?


Simply place a menustrip control on the form :-). You can use the new menu
control for popup menus too.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 15 '06 #7
Siv
Herfried,

Once I figured out how to get it to dock to the top of the form I got it
working. I tried using some of the bitmaps from the "Command" section of
the VS2005 Image Library. At the moment they appear in the menu with a
magenta background, I haven't run the app yet as I have some code that needs
tidying up before running. I assume the magenta bit will appear
transparent? If not how do I get the icons to appear as normal?

As always, thanks for your help!

Siv

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OV**************@TK2MSFTNGP10.phx.gbl...
"Siv" <dotnet@remove_me.sivill.com> schrieb:
I am using VB.NET 2005 with the 2.0 Framework, could you explain how the
menustrip works, I thought they were for creating pop-up menus?


Simply place a menustrip control on the form :-). You can use the new
menu control for popup menus too.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 16 '06 #8
"Siv" <dotnet@remove_me.sivill.com> schrieb:
I tried using some of the bitmaps from the "Command" section of the
VS2005 Image Library. At the moment they appear in the menu with a magenta
background, I haven't run the app yet as I have some code that needs
tidying up before running. I assume the magenta bit will appear
transparent? If not how do I get the icons to appear as normal?


Set the menu items' 'ImageTransparentColor' property to magenta.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 16 '06 #9
Siv
Herfried,
Thanks, this fixes the problem.
Siv

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eU**************@TK2MSFTNGP12.phx.gbl...
"Siv" <dotnet@remove_me.sivill.com> schrieb:
I tried using some of the bitmaps from the "Command" section of the
VS2005 Image Library. At the moment they appear in the menu with a
magenta background, I haven't run the app yet as I have some code that
needs tidying up before running. I assume the magenta bit will appear
transparent? If not how do I get the icons to appear as normal?


Set the menu items' 'ImageTransparentColor' property to magenta.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 16 '06 #10

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

Similar topics

2
by: todorov-fkt | last post by:
Hi, I know that Windows comes with own icons and bitmaps for menus, toolbars, etc, which are compiled into ressource dlls. Is it possible to use these images into the own program and how do I do...
2
by: ahmed khairy | last post by:
hi i wanted to put icons in my menu on a windows form. i already did that in the toolbar and wanted to put them same icons for the corresponding functions. thanks
0
by: Dragos Dutu | last post by:
Hello people! I have a quite complicated question. While creating a ToolBar in code, it is possible to pass the standard icons located in COMMCTRL to the image list of the ToolBar. I'm talking...
0
by: Robert Smith | last post by:
Hello, I have written some context menus in my application, however I see lots of nice icons on the menus that microsoft use. It is not obvious how one would add these icons to the menu items....
7
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form...
3
by: QLD_AU | last post by:
Is their a way in a VB.Net application to set all sub form icons to the main form ? or even set all icons to the Application icon, without having to reference the icon as a filename ? With...
17
by: Brett | last post by:
I'd like references on where to find some good (quality) icons to use for form and application icons (for the EXE). Most of the free stuff isn't that great looking and there isn't a good...
4
by: sonu | last post by:
Hi, Is it possible to attach the icons to the menus in VB.NET. I have read we have to use ownerdraw menus to do this. Does anyone know more than this. Sample application would be a better...
1
by: Jon Slaughter | last post by:
I'm trying to create a windows explorer like app and the problem I'm having is getting the proper icon for the folders and items. In windows explorer there are many different icons and most seem...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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,...

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.