code_junkie

Help getting .Net WinForms apps to support Vista Aero Glass

Nov 10th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. //reference Desktop Windows Manager (DWM API)
  2. [DllImport( "dwmapi.dll" )]
  3. static extern void DwmIsCompositionEnabled( ref bool pfEnabled );
  4.  
  5. [DllImport( "dwmapi.dll" )]
  6. static extern int DwmExtendFrameIntoClientArea( IntPtr hWnd, ref MARGINS pMarInset );
  7.  
  8.  
  9. //then on form load
  10. //check for Vista
  11. if ( Environment.OSVersion.Version.Major >= 6 )
  12. {
  13. //check for support
  14. bool isGlassSupported = false;
  15. DwmIsCompositionEnabled( ref isGlassSupported );
  16.  
  17. if ( isGlassSupported )
  18. DwmExtendFrameIntoClientArea( this.Handle, ref margins );
  19. ...
  20.  
  21. //finally on print draw a black box over the alpha-ed area
  22. //Before SP1 you could also use a black form background
Add Comment
Please, Sign In to add comment