Ejemplo n.º 1
0
        /// <summary>
        /// Get the size of a themed part in a givenstate.
        /// </summary>
        /// <param name="g">Graphics object reference.</param>
        /// <param name="part">Theme part.</param>
        /// <param name="state">Theme state of part.</param>
        /// <param name="themeSize">How to calculate the size.</param>
        /// <returns>new Size if themed; otherwise Size.Empty</returns>
        public Size GetThemePartSize(Graphics g, int part, int state, THEMESIZE themeSize)
        {
            Size retSize = Size.Empty;

            if (IsControlThemed)
            {
                Win32.SIZE size = new Win32.SIZE();

                IntPtr hDC = g.GetHdc();
                Uxtheme.GetThemePartSize(_hTheme, hDC, part, state, IntPtr.Zero, themeSize, ref size);
                g.ReleaseHdc(hDC);

                // Copy back results
                retSize.Width  = size.cx;
                retSize.Height = size.cy;
            }

            return(retSize);
        }
Ejemplo n.º 2
0
         public static extern IntPtr GetThemePartSize(SafeThemeHandle hTheme,
 IntPtr hdc, int iPartId, int iStateId, IntPtr prc,
 THEMESIZE eSize, ref Size psz);
Ejemplo n.º 3
0
 public static extern int GetThemePartSize([NativeTypeName("HTHEME")] IntPtr hTheme, [NativeTypeName("HDC")] IntPtr hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT *prc, [NativeTypeName("enum THEMESIZE")] THEMESIZE eSize, SIZE *psz);
Ejemplo n.º 4
0
 public static extern IntPtr GetThemePartSize(IntPtr hTheme, IntPtr hdc, ThemeParts iPartId, int iStateId,
                                              IntPtr prc, THEMESIZE eSize, out SIZE psz);
Ejemplo n.º 5
0
 public static extern IntPtr GetThemePartSize(IntPtr hTheme, IntPtr hdc, ThemeParts iPartId, int iStateId,
                                              [MarshalAs(UnmanagedType.Struct)] SIZE prc, THEMESIZE eSize, out SIZE psz);
Ejemplo n.º 6
0
 public static extern int GetThemePartSize(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, ref RECT prc, THEMESIZE eSize, ref SIZE psz);
Ejemplo n.º 7
0
 public static extern int GetThemePartSize(HandleRef hTheme, HandleRef hdc, int iPartId, int iStateId, IntPtr prc, THEMESIZE eSize, ref SIZE psz);
Ejemplo n.º 8
0
 public static extern HRESULT GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, [NativeTypeName("LPCRECT")] RECT *prc, [NativeTypeName("enum THEMESIZE")] THEMESIZE eSize, SIZE *psz);
 private static extern int GetThemePartSize(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, ref Rectangle prc, THEMESIZE eSize, ref Size psz);
Ejemplo n.º 10
0
 public Size?GetPartSize(IDeviceContext graphics, int partId, int stateId, Rectangle?destRect, THEMESIZE themeSize)
 {
     using (var hdc = new SafeDCHandle(graphics))
     {
         if (GetThemePartSize(hTheme, hdc, partId, stateId, destRect, themeSize, out var sz).Succeeded)
         {
             return(sz);
         }
         return(null);
     }
 }