|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Icons in Application MenusHi,
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. "Siv" <dotnet@remove_me.sivill.com> wrote in message You have to set the OwnerDraw property on the menu item. Then override the news:OBvrBjFSGHA.4440@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. > 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/2002/April/OwnerDrawMenusSK.asp 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 Show quoteHide quote "James Jardine" <james.jard***@geoage.com> wrote in message news:uXsNXsFSGHA.4752@TK2MSFTNGP10.phx.gbl... > > "Siv" <dotnet@remove_me.sivill.com> wrote in message > news:OBvrBjFSGHA.4440@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/2002/April/OwnerDrawMenusSK.asp >
Show quote
Hide quote
"Siv" <dotnet@remove_me.sivill.com> wrote in message Here is another link http://www.codeproject.com/cs/menu/menuimage.asp that news:%23qjEhzFSGHA.4456@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" <james.jard***@geoage.com> wrote in message > news:uXsNXsFSGHA.4752@TK2MSFTNGP10.phx.gbl... >> >> "Siv" <dotnet@remove_me.sivill.com> wrote in message >> news:OBvrBjFSGHA.4440@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/2002/April/OwnerDrawMenusSK.asp >> > > has better looking menus.. I hope this helps get you started. Good Luck jjardine "Siv" <dotnet@remove_me.sivill.com> schrieb: Which version of the .NET Framework are you using? If you are using .NET > 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. 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/> 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 Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:ODsSL5HSGHA.2536@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/> "Siv" <dotnet@remove_me.sivill.com> schrieb: Simply place a menustrip control on the form :-). You can use the new menu > 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? 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/> 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 Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:OV6wwaISGHA.4944@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/> "Siv" <dotnet@remove_me.sivill.com> schrieb: Set the menu items' 'ImageTransparentColor' property to magenta.> 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? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Herfried,
Thanks, this fixes the problem. Siv Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:eUWYF1ISGHA.5036@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/> |
|||||||||||||||||||||||