Пример #1
0
 public Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type)
 {
     if (dc == null)
     {
         throw new ArgumentNullException("dc");
     }
     if (!System.Windows.Forms.ClientUtils.IsEnumValid(type, (int)type, 0, 2))
     {
         throw new InvalidEnumArgumentException("type", (int)type, typeof(ThemeSizeType));
     }
     System.Windows.Forms.NativeMethods.SIZE psz = new System.Windows.Forms.NativeMethods.SIZE();
     using (WindowsGraphicsWrapper wrapper = new WindowsGraphicsWrapper(dc, TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping))
     {
         HandleRef hdc = new HandleRef(wrapper, wrapper.WindowsGraphics.DeviceContext.Hdc);
         this.lastHResult = System.Windows.Forms.SafeNativeMethods.GetThemePartSize(new HandleRef(this, this.Handle), hdc, this.part, this.state, new System.Windows.Forms.NativeMethods.COMRECT(bounds), type, psz);
     }
     return(new Size(psz.cx, psz.cy));
 }
 public Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type)
 {
     if (dc == null)
     {
         throw new ArgumentNullException("dc");
     }
     if (!System.Windows.Forms.ClientUtils.IsEnumValid(type, (int) type, 0, 2))
     {
         throw new InvalidEnumArgumentException("type", (int) type, typeof(ThemeSizeType));
     }
     System.Windows.Forms.NativeMethods.SIZE psz = new System.Windows.Forms.NativeMethods.SIZE();
     using (WindowsGraphicsWrapper wrapper = new WindowsGraphicsWrapper(dc, TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping))
     {
         HandleRef hdc = new HandleRef(wrapper, wrapper.WindowsGraphics.DeviceContext.Hdc);
         this.lastHResult = System.Windows.Forms.SafeNativeMethods.GetThemePartSize(new HandleRef(this, this.Handle), hdc, this.part, this.state, new System.Windows.Forms.NativeMethods.COMRECT(bounds), type, psz);
     }
     return new Size(psz.cx, psz.cy);
 }
 public static extern bool SetWindowExtEx(HandleRef hDC, int x, int y, [In, Out] System.Windows.Forms.NativeMethods.SIZE size);
 public static extern bool SetViewportExtEx(HandleRef hDC, int x, int y, System.Windows.Forms.NativeMethods.SIZE size);
 public static extern int GetThemePartSize(HandleRef hTheme, HandleRef hdc, int iPartId, int iStateId, [In] System.Windows.Forms.NativeMethods.COMRECT prc, ThemeSizeType eSize, [Out] System.Windows.Forms.NativeMethods.SIZE psz);