• 0

[C#] Context Menu Strip with Windows Vista look and feel


Question

Hi,

I've searched and searched google but can't find anything... I'm currently using 2 context menu strips in my application, one for the notification icon and another for the contextual menu of a textbox. I want them to have the look and feel of menus in Vista with the possibility to use icons. However, if the application is used on XP, I want the menus to have the look and feel of XP, also using the icons.

Can anyone help me out?

Recommended Posts

  • 0

You'd probably have to create your own Renderer for the ContextMenuStrip.

Have a look at this:

http://www.chaliy.com/TipsAndTricks/Vs2005LikeRendering/

and

http://www.codeproject.com/cs/menu/Office2007Renderer.asp

Edit, and this:

http://www.chaliy.com/Sources/RebarRenderer/Default.aspx

Edited by Winston
  • 0
So you have no clue right? Maybe this is only possible on VS2008 and with .NET 3.0 or maybe not? I'm not really sure as I don't have it, but it must be a way...

I could probably figure it out. Time is my only issue. I'd rather spend time with the ladies than coding. LOL

I'll see what I can come up with. I sincerely doubt it's only doable in 2008/3/3.5.

  • 0

Don't you just set the RenderMode to System?

contextMenuStrip1.RenderMode = ToolStripRenderMode.System;

EDIT: never mind, I see that doesn't do it either.

Edited by virtorio
  • 0
Don't you just set the RenderMode to System?

contextMenuStrip1.RenderMode = ToolStripRenderMode.System;

EDIT: never mind, I see that doesn't do it either.

The current render modes on VS don't do the trick. I'm using ManageRenderMode which looks like the image below, Professional (I think) also makes it look like the image:

ScalablePictureBox.jpg

In my google searches I only found about one thing. In VS2005, there's only one way to make the menus have the Vista look, I have to use the ContextMenu control and not the ContextMenuStrip. ContexMenu control is hidden, you have to add it to the toolbox. Although, there are no way to add icons to ContextMenu items, only owner-drawing, but that will loose the Vista look...

  • 0
I guess I could be wrong about it not being tied to 3.0/3.5... There has to be a way to do it natively. It's just going to take some digging. I just grabbed the latest SDK, so I'll take a look at it when I can.

Thanks, whenever you have an answer, reply back :)

  • 0

You can fully modify menustrips look and feel by using ToolStripRenderer. Just create a new class like this:

public class VistaToolstripRenderer : System.Design.ToolstripRenderer

... or something like that.

Take a look at following article in codeproject. It shows how to create a style which follows Office 2007 guidelines. If you can't accomplish the style you're trying to make, I may create it as part of my project called Cloud Toolkit.Net (https://sourceforge.net/projects/cloudtoolkitnet/). It has Office 2007 toolstriprenderer but not yet Vista or any else renderer

Codeproject article about ToolstripRenderer

Regards,

Timo Salom?ki

  • 0

The problem is that I don't want the Vista renderer. If that was the case, users running XP would have their menus themed with Vista look and that's not what I want. I want to have menus that have the visual style OS look and use icons.

  • 0

Oh right, you didn't make it so clear, I suggest this is what you do:

You can either create a class and inherit from the old ContextMenu item and do some owner drawing yourself, and refer to this class:

http://msdn2.microsoft.com/en-us/library/s....menu.item.aspx

To actually retrieve the current OS's Visual Style menu item state's.

Or you can create your own managed renderer for the ContextMenuStrip, and use the above class to handle the drawing logic as well.

[EDIT] OK, my bad, I just realised, that it's not a class supported under Vista, hmm that's weird, I think you'd really have to result into using some PInvoking to achieve it.

Edited by Winston
  • 0

Just out of curiosity, is there some reason why you don't just use one of the normal menu classes, and do all of the drawing yourself? You've probably already spent much more time looking for a boxed solution than you would have had you just done the GDI+ work yourself.

  • 0

That has been answered many times in this thread...

I can't use ContextMenu nor ContextMenuStrip because they don't use the system look depending on the OS and VisualStyle. Doing it in GDI+ wouldn't help at all. What if the user is using WindowBlinds or a hacked uxtheme.dll and use a different visual style? How is GDI+ going to help me there?

@Winston

I think I'll just forget it... I'm using ContextMenu for now, but I'm forgetting about the icons... Oh well, what you gonna do...

  • 0
I can't use ContextMenu nor ContextMenuStrip because they don't use the system look depending on the OS and VisualStyle. Doing it in GDI+ wouldn't help at all. What if the user is using WindowBlinds or a hacked uxtheme.dll and use a different visual style? How is GDI+ going to help me there?

Ummm... it'll help you because you can query the system (through Windows.Forms) to get the bitmaps/colours making up the interface at any particular moment, and then draw the menu dynamically using GDI+. There are a whole set of classes in .NET for exactly this type of scenario.

There's no need for attitude here. Since you've spent two weeks on this, I was JUST wondering why you hadn't already considered the path of least resistance..........

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Beats Studio Pro wireless over-ear ANC headphones drop to their lowest price yet by Fiza Ali Amazon is currently offering the Beats Studio Pro headphones at their all-time low price. The Studio Pro use 40mm active drivers which are designed to improve clarity and reduce distortion compared to previous models, with up to an 80% improvement over the Beats Studio3 Wireless. A built-in digital processor adjusts frequency response to keep the sound balanced rather than overly boosted in any one area. They also include Active Noise Cancelling that adapts to your surroundings to reduce background noise along with a Transparency mode that lets outside sound in when you need awareness of what’s going on around you. Furthermore, the headphones support personalised Spatial Audio with dynamic head tracking as well as Dolby Atmos playback on supported content. Moreover, built-in voice-targeting microphones improve call quality. You can also switch between three sound profiles including Beats Signature for balanced music playback, Entertainment for films and gaming, and Conversation for clearer voice in calls and podcasts. Physically, they are designed to be worn for long periods without feeling heavy or awkward. The ear cushions use UltraPlush engineered leather while metal sliders allow you to adjust the fit. On the connectivity side, the Studio Pro use Class 1 Bluetooth for a stable, long-range wireless connection. There is also a 3.5mm input if you want to plug in directly, including use with in-flight entertainment systems. Controls are located on the headphones and include a "b" button for music and call control, a volume rocker, and a multifunction button used for switching listening modes, EQ settings, power, and pairing. In addition, the headphones offer integration with both Apple and Android devices. On Apple devices, they support one-touch pairing with iCloud-linked devices, hands-free Siri access, Find My tracking based on last connected location, and automatic software updates. On Android devices, they support Google Fast Pair, Audio Switch between compatible devices, and Google Find My Device tracking, with additional features available through the Beats app. When it comes to the battery performance, it is rated at up to 40 hours of listening time with ANC turned off, and up to 24 hours with ANC or Transparency mode enabled. A 10-minute Fast Fuel charge should provide up to 4 hours of playback. Finally, the headphones use a rechargeable lithium-ion battery and charge via USB-C. Beats Studio Pro Wireless Over-Ear ANC Headphones: $149.95 (Amazon US) Good to know This Amazon deal is U.S. specific, and not available in other regions unless specified. We only use first-party seller links (at the time of article publishing); ensure that you purchase from a first-party seller link only. Check out Today's Deals on Amazon | or our recent tech deals. Become a Prime member (for Students or SNAP) via Neowin Get Prime Access - Prime for half price (for qualifying Medicaid, EBT, SNAP) Subscribe to Prime Video, Audible Plus, Music Unlimited or Kindle Unlimited via Neowin As an Amazon Associate, we earn from qualifying purchases.
    • "lets you pause updates by choosing an end date, for up to 35 days" Wasn't it "indefinitely"?
    • Those extra reboots are related to the UEFI Secure Boot certificate update thing.
    • Hands on with the ProtoArc EM25: Affordable ergonomic mouse that focuses on the right things by Taras Buria ProtoArc is known for making all sorts of office products with a big focus on ergonomics and comfort. Its latest product, the EM25, promises a comfortable-to-use, affordable, and customizable mouse. We took one for a spin; here are our impressions. The ProtoArc EM25 is a $49.99 mouse, but right now, during Prime Day 2026, you can get it for just $37.99. Right off the bat, you can see that the EM25 is inspired by Logitech's MX Master lineup and the legendary MX Master 3/3S. Its shape and proportions are very similar, so for a person with large hands (right-handed person, mind you), the EM25 is very comfortable to use. The mouse fills the palm, and the thumb rests on a small extension, giving your wrist a small tilt to reduce strain. The mouse is made of black plastic without any coating, eliminating long-term wear concerns. However, I can see the main buttons and other areas you touch the most getting polished over time. Despite its size and bulk, the mouse is not too heavy. It weighs about 100 grams, which is significantly less than the MX Master 3S and its successor. It is no lightweight gaming mouse by any means, but it is not excessively heavy like the MX Master 4. The EM25 has a built-in storage for its USB dongle. It is a cleverly made magnetic flap that you open by simply pressing on it. Next to the flap, you will find the on/off switch, the 1,000 Hz sensor, and a DPI button (up to 8,000 DPI). I find the DPI button location a bit odd, and I would prefer it somewhere below the main scroll wheel. Still, given that I never change DPI on my mice, I will let it pass. What is more important is that, unlike MX Master 3/3S/4, the device switch button is located below the left-click button, which allows you to switch devices without lifting and flipping the mouse. For a multi-device setup, this is a perfect solution: the button does not require too much effort to use, it does not get in your way, but it is also easily reachable with your thumb. The main scroll wheel has two modes: ratcheted and free-flow. You can only change between them with a bright orange button (I like this little touch of color), which is sprung and requires some effort to press. The wheel is dead-silent in free-flow mode, but ratched is quite loud and stiff, perhaps even too much to my liking. I can hardly call it deal-breaking, but it will certainly take some time to get used to. The side scroll wheel, it is notched, silent, and pleasant to use. Next to it, you can find a piece of glossed plastic with connection indicators: Dongle, Bluetooth 1, Bluetooth 2, and the low battery indicator. By the way, the built-in battery is rechargeable via a USB Type-C cable, which is included. It is sleeved and has an orange velcro strap to keep it tidy. After using the EM25 for a few weeks, I can say that its main buttons are my absolute favorite. They have very pronounced clicks, which feel great with just the right amount of force required to register a press. I would say they feel like something in between regular mouse clicks and silent ones. You can hear and feel the springy switch, but it is not sharp or loud to the point of annoying you. As for back/forward and device switch buttons, they are very clicky and quite noisy. Unfortunately, there are no extra buttons that you can map to specific things like in the MX Master lineup. Besides great primary clicks, another thing I like about the EM25 is its 1,000 Hz sensor. In the world, where Logitech still uses 125 Hz sensors in $100+ mice, seeing a much faster sensor in a mouse that costs three times less is very refreshing. Also, all the settings and customization you make are stored on-device, and you do not need to install any software. Just open the web-based app and change all that you need. Speaking of customization, you can remap what buttons do, adjust the DPI, and the sensor speed. Sadly, gestures are not supported, but you can still map pretty much anything to each button, including shortcuts, media buttons, and more. I also recommend using software like XMouseControl, as it will let you remap the side scroll wheel. At the end of the day, the ProtoArc EM25 is a great mouse. Clearly inspired by the MX Master lineup, it takes the best of it and complements it with a much more wallet-friendly price tag, significantly better sensor, on-device memory, a built-in storage for the dongle, and more (it fixes everything that I complained about the MX Master 4 recently). And for only $37.99 during Prime Day, the EM25 is an easy recommendation. Buy ProtoArc EM25 mouse - $37.99 | 24% off with Prime As an Amazon Associate, we earn from qualifying purchases.
    • Pretty nice tool, thanks
  • Recent Achievements

    • Rookie
      DaviKar went up a rank
      Rookie
    • Dedicated
      HidekoYamamoto94 earned a badge
      Dedicated
    • One Month Later
      timbobit earned a badge
      One Month Later
    • One Month Later
      nates earned a badge
      One Month Later
    • Week One Done
      Almohandis earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      460
    2. 2
      +Edouard
      161
    3. 3
      PsYcHoKiLLa
      110
    4. 4
      Michael Scrip
      81
    5. 5
      Steven P.
      69
  • Tell a friend

    Love Neowin? Tell a friend!