Archive for 2007

Vista-style menus in .NET

Update: there’s an improved version now! (The source code is in a different repository now, so the source code link below works but is outdated.)

Ever noticed that .NET-style menus are ugly?

Windows Vista comes with a new style of menus (which allow images, too), and a few updates to the UxTheme API, including the ability to render these themed menus. When the .NET framework was designed, however, this functionality wasn’t available; and you can see this clearly by looking at a default MenuStrip.

But ToolStrip allows you to give it a new renderer (via its Renderer property), and you can write a ToolStripRenderer that draws menus using UxTheme with not too much effort.

And that’s exactly what I’ve done, and you can have the source code. Do what you like with it. It only really works with menu bars and context menu bars, because I didn’t need it for anything else.

You can apply it in one of two ways, both pretty simple.

  • toolStrip1.Renderer = new NativeToolStripRenderer();
  • NativeToolStripRenderer.SetToolStripRenderer(menuStrip, contextMenuStrip);

Here’s some screenshots:
Using Aero (Vista) Theme (120dpi)
Using Luna (XP) Theme (120dpi)
Using Windows Classic Theme (120dpi)

If you do use this, here are some scenarios to test:

  • Starting with Aero on, and turning it on/off and switching into classic mode a few times
  • Starting with Aero off, and turning it on/off and switching into classic mode a few times

In a similar vein, there is also a WindowsVistaRenderer on The Code Project, which draws the sort of dark toolbars you can see in Windows Media Player 11, Windows Photo Gallery, etc.

Posted on Sunday, December 9th, 2007 in .NET, Code, GDNet, Szótár | Comments Off

Fractals with Canvas 3D

If you have Firefox 3 and feel like watching some hypnotic fractals, I recently made a demo using the Canvas 3D preview. It’s done using an OpenGL 2.0 fragment shader, so the precision isn’t amazing - there’s only so much you can do with 32-bit floating point numbers… But it’s not too bad if you can’t zoom in.

See it here. It requires the canvas 3d extension to be installed, and OpenGL 2.0 support.

Julia Set 1 Julia Set 2

Posted on Thursday, December 6th, 2007 in Code | 1 Comment

PropertyGrid

I quite like PropertyGrid. Here’s a simple dictionary editor made by binding a PropertyGrid to a DictionaryInfo object. :)

Dictionary Info Editor Selecting an Encoding

Posted on Thursday, December 6th, 2007 in Code, Szótár | Comments Off