SHARE
TWEET

Untitled

a guest Jun 16th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private bool DrawTheme(Graphics graphics, XPThemeClasses themeClass, int themePart, int themeState, int x, int y, int width, int height)
  2. {
  3.     bool myResult;
  4.     IntPtr myHdc = graphics.GetHdc();
  5.     try
  6.     {
  7.         NativeMethods.RECT myRect = new NativeMethods.RECT(x, y, width, height);
  8.         IntPtr myThemeData = GetThemeData(themeClass);
  9.         if (NativeMethods.IsThemeBackgroundPartiallyTransparent(myThemeData, themePart, themeState))
  10.         {
  11.             IntPtr hwnd = NativeMethods.WindowFromDC(myHdc);
  12.             int res = NativeMethods.DrawThemeParentBackground(hwnd, myHdc, ref myRect);
  13.         }
  14.         myResult = (0 <= NativeMethods.DrawThemeBackground(
  15.           myThemeData,
  16.           myHdc,
  17.           themePart,
  18.           themeState,
  19.           ref myRect, ref myRect));
  20.     }
  21.     catch
  22.     {
  23.         myResult = false;
  24.     }
  25.     finally
  26.     {
  27.         graphics.ReleaseHdc(myHdc);
  28.     }
  29.     return myResult;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top