Prev | Current Page 441 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

However, you
can place completely opaque WPF elements on the glass frame to create a similar
effect.
??? The nonglass region inside your window is always defined as a rectangle.
WPF doesn??™t include classes for performing this effect. Instead, you need to call the
DwmExtendFrameIntoClientArea() function from the Win32 API. (The Dwm prefix refers to
the desktop window manager that controls this effect.) Calling this function allows you to
extend the frame into your client area by making one or all of the edges thicker.
Here??™s how you can import the DwmExtendFrameIntoClientArea() function so it??™s callable
from your application:
_
Public Shared Function DwmExtendFrameIntoClientArea( _
ByVal hwnd As IntPtr, ByRef pMarInset As Margins) As Integer
End Function
You also need to define the fixed Margins structure, as shown here:
_
Public Structure Margins
Public cxLeftWidth As Integer
Public cxRightWidth As Integer
Public cyTopHeight As Integer
Public cyBottomHeight As Integer
End Structure
This has one potential stumbling block. As you already know, the WPF measurement system
uses device-independent units that are sized based on the system DPI setting. However,
the DwmExtendFrameIntoClientArea() uses physical pixels. To make sure your WPF elements
line up with your extended glass frame no matter what the system DPI, you need to take the
system DPI into account in your calculations.


Pages:
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453