Tag Archive: win32

Feb 12

Drawing non-themed push buttons in Windows

Non-Themed-Buttons.png

When visual styles are enabled in Windows, one may use the DrawThemeBackground function to draw themed push buttons. However, users of Windows XP, Windows Vista and Windows 7 can disable visual styles by selecting the Windows Classic theme or one of the High Contrast themes (and in Windows 2000 and earlier, visual styles weren’t available …

Continue reading »

Nov 12

When should a program’s UI animations be disabled?

PerfOptions2.png

Modern frameworks like the Windows Presentation Foundation, its relative Silverlight and the upcoming Windows Runtime make it easy to add animations to a program’s graphical user interface. When implemented well, animations subtly improve the user experience and can demonstrate a high level of polish in your application. The Zune client software and Windows Live Messenger …

Continue reading »

Oct 24

Windows Theme Fonts Redux & Sample Code

WPFSampleThemed.png

In a post earlier this year, I investigated how to retrieve information about theme fonts in Windows. Briefly, the Visual Styles APIs can be used when visual styles are enabled, but values need to be hard-coded (to some extent) otherwise. Andrew Powell commented on my previous post noting difficulties in implementing the GetThemeFont function in …

Continue reading »

Apr 30

Windows Theme Fonts

TaskDialog.png

Update: See this post for a sample implementation in WPF. Have you ever wondered how to access the various font colours and styles found throughout Windows, such as that of the ‘Main Instruction’ text in the Task Dialog shown above? If you are using WPF, the SystemFonts class might sound promising at first. However, this …

Continue reading »

Mar 21

WM_DWMCOLORIZATIONCOLORCHANGED doesn’t give the Aero Glass base colour

colorization.png

From MSDN: WM_DWMCOLORIZATIONCOLORCHANGED Message Sent to all top-level windows when the colorization color has changed. Parameters wParam: Specifies the new colorization color. The color format is 0xAARRGGBB. lParam: Specifies whether the new color is blended with opacity. We receive this message when the Aero Glass colour changes. Unfortunately, the value contained in wParam is not …

Continue reading »

Jan 07

Small Icon Size & DPI in Windows

The GetSystemMetrics function in Windows retrieves system metrics and configuration settings. One such metric is the recommended size (width and height) of ‘small icons’: Small icons typically appear in window captions and in small icon view. Another place where small icons show up is the notification area. MSDN contains a guide to Creating DPI-Aware Applications. …

Continue reading »

Dec 28

Windows 7-style Notification Area Applications in WPF: Part 6 (Notify Icon Position: Pre-Windows 7)

Spy.png

In Part 2 of this series I demonstrated how to use the Shell_NotifyIconGetRect function to find the position of a notify icon. This function is new to Windows 7, however, and we must find a different solution for earlier versions of Windows. This turns out to be quite difficult. A post on the MSDN forums …

Continue reading »

Dec 20

Windows 7-style Notification Area Applications in WPF: Part 5 (Fixing Aero Borders)

Aero-Border.png

An issue that came to my attention only recently is that the borders of WPF (update: WPF is not actually to blame) windows without captions/title-bars (that is, with ResizeMode set to ‘CanResize’ and WindowStyle set to ‘None’) are drawn incorrectly when the DWM (read: Aero Glass) is enabled. Specifically, the upper and left borders are …

Continue reading »

Dec 11

Windows 7-style Notification Area Applications in WPF: Part 4 (Multiple Monitors)

At the end of Part 3 in this series, I noted that the window positioning logic depends on accurately getting the bounds of the monitor where the notify icon is located. Specifically, we require the bounds of the working area (the space on the monitor excluding the taskbar and other docked items). WPF gives us …

Continue reading »

Dec 09

Windows 7-style Notification Area Applications in WPF: Part 3 (Taskbar Position)

Notification-Area-Right-Aligned.png

In the previous post in this series, I showed how to find the location of a notify icon by implementing the new Windows 7 Shell32.dll function Shell_NotifyIconGetRect in managed code for use with the System.Windows.Forms.NotifyIcon class. In this post, I will look at how to accurately position a window above (or adjacent to) a notify …

Continue reading »

Older posts «