Ignore:
Timestamp:
8/8/2010 7:02:56 AM (22 months ago)
Author:
lowjoel
Message:

Use the VisualStylesRenderer? class to draw the theme parts instead of P/Invoking everything directly.

  • As part of the changes, the algorithms used to compute the sizes of theme components e.g. gutter width, margin with, check mark rectangle, check mark background rectangle have been rewritten. These new algorithms work across DPI settings. Addresses #303: Verify Eraser's UI in high DPI mode
  • Remove unnecessary UxTheme?.cs P/Invoke declarations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.Util/NativeMethods/UxTheme.cs

    r1802 r2242  
    5252            string pszSubIdList); 
    5353 
    54         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    55         public static extern SafeThemeHandle OpenThemeData(IntPtr hwnd, string pszClassList); 
    56  
    57         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    58         public static extern IntPtr CloseThemeData(IntPtr hwndTeme); 
    59  
    60         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    61         public static extern IntPtr DrawThemeParentBackground(IntPtr hwnd, 
    62             IntPtr hdc, ref Rectangle prc); 
    63  
    64         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    65         [return: MarshalAs(UnmanagedType.Bool)] 
    66         public static extern bool IsThemeBackgroundPartiallyTransparent( 
    67             SafeThemeHandle hTheme, int iPartId, int iStateId); 
    68  
    69         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    70         public static extern IntPtr DrawThemeBackground( 
    71             SafeThemeHandle hTheme, IntPtr hdc, int iPartId, int iStateId, 
    72             ref Rectangle pRect, ref Rectangle pClipRect); 
    73  
    74         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    75         public extern static int DrawThemeText(SafeThemeHandle hTheme, 
    76             IntPtr hDC, int iPartId, int iStateId, 
    77             [MarshalAs(UnmanagedType.LPWStr)] string pszText, int iCharCount, 
    78             TextFormatFlags dwTextFlag, int dwTextFlags2, ref Rectangle pRect); 
    79  
    80         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    81         public static extern IntPtr GetThemeMargins(SafeThemeHandle hTheme, 
    82             IntPtr hdc, int iPartId, int iStateId, int iPropId, ref Rectangle prc, 
    83             ref Rectangle pMargins); 
    84  
    85         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    86         public static extern IntPtr GetThemeMargins(SafeThemeHandle hTheme, 
    87             IntPtr hdc, int iPartId, int iStateId, int iPropId, IntPtr prc, 
    88             ref Rectangle pMargins); 
    89  
    90         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    91         public static extern IntPtr GetThemePartSize(SafeThemeHandle hTheme, 
    92             IntPtr hdc, int iPartId, int iStateId, ref Rectangle prc, 
    93             THEMESIZE eSize, ref Size psz); 
    94  
    95         [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 
    96         public static extern IntPtr GetThemePartSize(SafeThemeHandle hTheme, 
    97             IntPtr hdc, int iPartId, int iStateId, IntPtr prc, 
    98             THEMESIZE eSize, ref Size psz); 
    99  
    100         public enum MENUPARTS 
     54        public enum MENUPARTS : int 
    10155        { 
    10256            MENU_MENUITEM_TMSCHEMA = 1, 
     
    151105        } 
    152106 
    153         public enum TMT_MARGINS 
    154         { 
    155             TMT_SIZINGMARGINS = 3601, 
    156             TMT_CONTENTMARGINS, 
    157             TMT_CAPTIONMARGINS 
    158         } 
    159  
    160         public enum THEMESIZE 
    161         { 
    162             TS_MIN, 
    163             TS_TRUE, 
    164             TS_DRAW 
    165         } 
    166  
    167107        public const int WM_THEMECHANGED = 0x031A; 
    168108        public const int WM_DWMCOMPOSITIONCHANGED = 0x031E; 
Note: See TracChangeset for help on using the changeset viewer.