using System; using System.Drawing; using System.Runtime.InteropServices; using System.Text; using Vanara.Extensions; using static Vanara.PInvoke.Gdi32; using static Vanara.PInvoke.User32_Gdi; namespace Vanara.PInvoke { /// Methods and enumerations from uxtheme.dll public static partial class UxTheme { /// Retrieves the name of the author of the theme. public const string SZ_THDOCPROP_AUTHOR = "author"; /// Retrieves the name of the theme. public const string SZ_THDOCPROP_CANONICALNAME = "ThemeName"; /// Retrieves the display name of the theme. public const string SZ_THDOCPROP_DISPLAYNAME = "DisplayName"; /// Retrieves the tooltip associated with this theme. public const string SZ_THDOCPROP_TOOLTIP = "ToolTip"; /// Callback function for DrawThemeTextEx. /// HDC to use for drawing. /// Pointer to a string that contains the text to draw. /// /// Value of type int that contains the number of characters to draw. If the parameter is set to -1, all the characters in the string /// are drawn. /// /// /// Pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the text is to be drawn. /// /// /// DWORD that contains one or more values that specify the string's formatting. See Format Values for possible parameter values. /// /// Parameter for callback back function specified by pfnDrawTextCallback. /// Undocumented [PInvokeData("Uxtheme.h")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Unicode)] public delegate int DTT_CALLBACK_PROC(HDC hdc, string pszText, int cchText, ref RECT prc, DrawTextFlags dwFlags, IntPtr lParam); /// Flags that specify the selected options for DTBGOPTS. [PInvokeData("Uxtheme.h")] [Flags] public enum DrawThemeBackgroundFlags { /// No flags are set. None = 0, /// rcClip specifies the rectangle to which drawing is clipped. DTBG_CLIPRECT = 1, /// Deprecated. Draw transparent and alpha images as solid. DTBG_DRAWSOLID = 2, /// Do not draw the border of the part (currently this value is only supported for bgtype=borderfill). DTBG_OMITBORDER = 4, /// Do not draw the content area of the part (currently this value is only supported for bgtype=borderfill). DTBG_OMITCONTENT = 8, /// Deprecated. DTBG_COMPUTINGREGION = 16, /// Assume the hdc is mirrored and flip images as appropriate (currently this value is only supported for bgtype=imagefile). DTBG_MIRRORDC = 32, /// Do not mirror the output; even in right-to-left (RTL) layout. DTBG_NOMIRROR = 64 } /// Flags for DrawThemeParentBackgroundEx. [PInvokeData("Uxtheme.h")] [Flags] public enum DrawThemeParentBackgroundFlags { /// No flags are set. None = 0, /// If set, hdc is assumed to be a window DC, not a client DC. DTPB_WINDOWDC = 1, /// /// If set, this function sends a WM_CTLCOLORSTATIC message to the parent and uses the brush if one is provided. Otherwise, it /// uses COLOR_BTNFACE. /// DTPB_USECTLCOLORSTATIC = 2, /// /// If set, this function returns S_OK without sending a WM_CTLCOLORSTATIC message if the parent actually painted on WM_ERASEBKGND. /// DTPB_USEERASEBKGND = 4 } /// /// A combination of flags that specify whether certain values of the DTTOPTS structure have been specified, and how to interpret /// these values. This member can be a combination of the following. /// [PInvokeData("Uxtheme.h")] [Flags] public enum DrawThemeTextOptionsMasks { /// The crText member value is valid. DTT_TEXTCOLOR = 1, /// The crBorder member value is valid. DTT_BORDERCOLOR = 2, /// The crShadow member value is valid. DTT_SHADOWCOLOR = 4, /// The iTextShadowType member value is valid. DTT_SHADOWTYPE = 8, /// The ptShadowOffset member value is valid. DTT_SHADOWOFFSET = 16, /// The iBorderSize member value is valid. DTT_BORDERSIZE = 32, /// The iFontPropId member value is valid. DTT_FONTPROP = 64, /// The iColorPropId member value is valid. DTT_COLORPROP = 128, /// The iStateId member value is valid. DTT_STATEID = 256, /// /// The pRect parameter of the DrawThemeTextEx function that uses this structure will be used as both an in and an out parameter. /// After the function returns, the pRect parameter will contain the rectangle that corresponds to the region calculated to be drawn. /// DTT_CALCRECT = 512, /// The fApplyOverlay member value is valid. DTT_APPLYOVERLAY = 1024, /// The iGlowSize member value is valid. DTT_GLOWSIZE = 2048, /// The pfnDrawTextCallback member value is valid. DTT_CALLBACK = 4096, /// /// Draws text with antialiased alpha. Use of this flag requires a top-down DIB section. This flag works only if the HDC passed /// to function DrawThemeTextEx has a top-down DIB section currently selected in it. For more information, see Device-Independent Bitmaps. /// DTT_COMPOSITED = 8192 } /// The flags that specify how the bitmap is to be retrieved by GetThemeBitmap. [PInvokeData("Uxtheme.h", MSDNShortId = "bb773388")] [Flags] public enum GBF : uint { /// Retrieves a handle to the existing bitmap. GBF_DIRECT = 1, /// Retrieves a copy of the bitmap. GBF_COPY = 2 } /// Option values that are used with the dwOptions parameter of the HitTestThemeBackground function. [PInvokeData("Uxtheme.h", MSDNShortId = "bb773203")] [Flags] public enum HitTestOptions : uint { /// Theme background segment hit test option. HTTB_BACKGROUNDSEG = 0x00000000, /// Fixed border hit test option. HTTB_FIXEDBORDER = 0x00000002, /// Caption hit test option. HTTB_CAPTION = 0x00000004, /// Resizing left border hit test option. HTTB_RESIZINGBORDER_LEFT = 0x00000010, /// Resizing top border hit test option. HTTB_RESIZINGBORDER_TOP = 0x00000020, /// Resizing right border hit test option. HTTB_RESIZINGBORDER_RIGHT = 0x00000040, /// Resizing bottom border hit test option. HTTB_RESIZINGBORDER_BOTTOM = 0x00000080, /// Resizing border hit test options. HTTB_RESIZINGBORDER = (HTTB_RESIZINGBORDER_LEFT | HTTB_RESIZINGBORDER_TOP | HTTB_RESIZINGBORDER_RIGHT | HTTB_RESIZINGBORDER_BOTTOM), /// /// Resizing border is specified as a template, not just window edges. This option is mutually exclusive with /// HTTB_SYSTEMSIZINGMARGINS; HTTB_SIZINGTEMPLATE takes precedence. /// HTTB_SIZINGTEMPLATE = 0x00000100, /// /// Uses the system resizing border width rather than visual style content margins. This option is mutually exclusive with /// HTTB_SIZINGTEMPLATE; HTTB_SIZINGTEMPLATE takes precedence. /// HTTB_SYSTEMSIZINGMARGINS = 0x00000200, } /// Optional flags that control how to return the theme data. [PInvokeData("Uxtheme.h", MSDNShortId = "bb759823")] [Flags] public enum OpenThemeDataOptions { /// No flags are set. None = 0, /// Forces drawn images from this theme to stretch to fit the rectangles specified by drawing functions. OTD_FORCE_RECT_SIZING = 1, /// Allows theme elements to be drawn in the non-client area of the window. OTD_NONCLIENT = 2 } /// Returned by GetThemePropertyOrigin to specify where a property was found. // typedef enum { PO_STATE = 0, PO_PART = 1, PO_CLASS = 2, PO_GLOBAL = 3, PO_NOTFOUND = 4} PROPERTYORIGIN; https://msdn.microsoft.com/en-us/library/windows/desktop/bb759837(v=vs.85).aspx [PInvokeData("Uxtheme.h", MSDNShortId = "bb759837")] public enum PROPERTYORIGIN { /// Property was found in the state section. PO_STATE = 0, /// Property was found in the part section. PO_PART = 1, /// Property was found in the class section. PO_CLASS = 2, /// Property was found in the list of global variables. PO_GLOBAL = 3, /// Property was not found. PO_NOTFOUND = 4 } /// A property that is associated with an animation storyboard and target. [PInvokeData("Uxtheme.h", MSDNShortId = "hh404183")] public enum TA_PROPERTY { /// Undocumented TAP_FLAGS, /// Undocumented TAP_TRANSFORMCOUNT, /// Undocumented TAP_STAGGERDELAY, /// Undocumented TAP_STAGGERDELAYCAP, /// Undocumented TAP_STAGGERDELAYFACTOR, /// Undocumented TAP_ZORDER, } /// Undocumented values for the TA_TRANSFORM structure returned by GetThemeAnimationTransform. [PInvokeData("Uxtheme.h", MSDNShortId = "hh404183")] [Flags] public enum TA_PROPERTY_FLAG { /// Undocumented TAPF_NONE = 0x0, /// Undocumented TAPF_HASSTAGGER = 0x1, /// Undocumented TAPF_ISRTLAWARE = 0x2, /// Undocumented TAPF_ALLOWCOLLECTION = 0x4, /// Undocumented TAPF_HASBACKGROUND = 0x8, /// Undocumented TAPF_HASPERSPECTIVE = 0x10, } /// Undocumented values for the TA_TIMINGFUNCTION structure returned by GetThemeTimingFunction. [PInvokeData("Uxtheme.h", MSDNShortId = "hh404194")] public enum TA_TIMINGFUNCTION_TYPE { /// Undocumented TTFT_UNDEFINED, /// Undocumented TTFT_CUBIC_BEZIER, } /// Undocumented values for the TA_TRANSFORM structure returned by GetThemeAnimationTransform. [PInvokeData("UxTheme.h")] [Flags] public enum TA_TRANSFORM_FLAG { /// Undocumented TATF_NONE = 0x0, /// Undocumented TATF_TARGETVALUES_USER = 0x1, /// Undocumented TATF_HASINITIALVALUES = 0x2, /// Undocumented TATF_HASORIGINVALUES = 0x4, } /// Undocumented values for the TA_TRANSFORM structure returned by GetThemeAnimationTransform. [PInvokeData("UxTheme.h")] public enum TA_TRANSFORM_TYPE { /// Undocumented TATT_TRANSLATE_2D, /// Undocumented TATT_SCALE_2D, /// Undocumented TATT_OPACITY, /// Undocumented TATT_CLIP, } /// Flags used by the iTextShadowType member of DTTOPS. [PInvokeData("UxTheme.h")] public enum TextShadowType { /// No shadow will be drawn. /// TST_NONE TST_NONE = 0, /// The shadow will be drawn to appear detailed underneath text. /// TST_SINGLE TST_SINGLE = 1, /// The shadow will be drawn to appear blurred underneath text. /// TST_CONTINUOUS TST_CONTINUOUS = 2 } /// Values returned by GetThemeAppProperties. [PInvokeData("UxTheme.h", MSDNShortId = "bb773320")] [Flags] public enum ThemeAppProperties : uint { /// Specifies that the non-client areas of application windows have visual styles applied. STAP_ALLOW_NONCLIENT = (1U << 0), /// Specifies that controls in application windows have visual styles applied. STAP_ALLOW_CONTROLS = (1U << 1), /// Specifies that all web content displayed in an application is rendered using visual styles. STAP_ALLOW_WEBCONTENT = (1U << 2), } /// Options for EnableThemeDialogTexture. [PInvokeData("UxTheme.h", MSDNShortId = "bb773320")] [Flags] public enum ThemeDialogTextureFlags { /// Disables background texturing. ETDT_DISABLE = 0x00000001, /// Enables dialog window background texturing. The texturing is defined by a visual style. ETDT_ENABLE = 0x00000002, /// Uses the Tab control texture for the background texture of a dialog window. ETDT_USETABTEXTURE = 0x00000004, /// /// Enables dialog window background texturing. The texture is the Tab control texture defined by the visual style. This flag is /// equivalent to (ETDT_ENABLE | ETDT_USETABTEXTURE). /// ETDT_ENABLETAB = (ETDT_ENABLE | ETDT_USETABTEXTURE), /// Uses the Aero wizard texture for the background texture of a dialog window. ETDT_USEAEROWIZARDTABTEXTURE = 0x00000008, /// ETDT_ENABLE | ETDT_USEAEROWIZARDTABTEXTURE. ETDT_ENABLEAEROWIZARDTAB = (ETDT_ENABLE | ETDT_USEAEROWIZARDTABTEXTURE), /// ETDT_DISABLE | ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_USEAEROWIZARDTABTEXTURE. ETDT_VALIDBITS = (ETDT_DISABLE | ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_USEAEROWIZARDTABTEXTURE), } /// Identifies the type of size value to retrieve for a visual style part. // typedef enum { TS_MIN, TS_TRUE, TS_DRAW} THEME_SIZE; https://msdn.microsoft.com/en-us/library/windows/desktop/bb759839(v=vs.85).aspx [PInvokeData("Uxtheme.h", MSDNShortId = "bb759839")] public enum THEMESIZE { /// Receives the minimum size of a visual style part. TS_MIN, /// Receives the size of the visual style part that will best fit the available space. TS_TRUE, /// Receives the size that the theme manager uses to draw a part. TS_DRAW } /// Specifies the type of visual style attribute to set on a window. // typedef enum { WTA_NONCLIENT = 1} WINDOWTHEMEATTRIBUTETYPE; https://msdn.microsoft.com/en-us/library/windows/desktop/bb759870(v=vs.85).aspx [PInvokeData("Uxtheme.h", MSDNShortId = "bb759870")] public enum WINDOWTHEMEATTRIBUTETYPE { /// Non-client area window attributes will be set. WTA_NONCLIENT = 1, } /// Specifies flags that modify window visual style attributes. Use one, or a bitwise combination of the following values. [PInvokeData("Uxtheme.h", MSDNShortId = "bb759875")] [Flags] public enum WTNCA { /// Prevents the window caption from being drawn. WTNCA_NODRAWCAPTION = 0x00000001, /// Prevents the system icon from being drawn. WTNCA_NODRAWICON = 0x00000002, /// Prevents the system icon menu from appearing. WTNCA_NOSYSMENU = 0x00000004, /// Prevents mirroring of the question mark, even in right-to-left (RTL) layout. WTNCA_NOMIRRORHELP = 0x00000008 } /// Closes the theme data handle. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT CloseThemeData( _In_ HTHEME hTheme); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773287(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773287")] public static extern HRESULT CloseThemeData(HTHEME hTheme); /// Draws the border and fill defined by the visual style for the specified control part. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC used for drawing the theme-defined background image. /// /// /// Type: int /// Value of type int that specifies the part to draw. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part to draw. See Parts and States. /// /// /// Type: const RECT* /// /// Pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the background image is drawn. /// /// /// /// Type: const RECT* /// Pointer to a RECT structure that contains a clipping rectangle. This parameter may be set to NULL. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT DrawThemeBackground( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ const RECT *pRect, _In_ // const RECT // *pClipRect); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773289(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773289")] public static extern HRESULT DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, in RECT pRect, PRECT pClipRect); /// /// /// [ DrawThemeBackgroundEx is available for use in the operating systems specified in the Requirements section. It may be /// altered or unavailable in subsequent versions.] /// /// Draws the background image defined by the visual style for the specified control part. /// /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC used for drawing the theme-defined background image. /// /// /// Type: int /// Value of type int that specifies the part to draw. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part to draw. See Parts and States. /// /// /// Type: const RECT* /// /// Pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the background image is drawn. /// /// /// /// Type: const DTBGOPTS* /// Pointer to a DTBGOPTS structure that contains clipping information. This parameter may be set to NULL. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT DrawThemeBackgroundEx( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ const RECT *pRect, _In_ // const DTBGOPTS // *pOptions); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773294(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773294")] public static extern HRESULT DrawThemeBackgroundEx(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, in RECT pRect, DTBGOPTS pOptions); /// Draws one or more edges defined by the visual style of a rectangle. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC. /// /// /// Type: int /// Value of type int that specifies the part that contains the rectangle. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: LPCRECT /// Pointer to a RECT structure that contains, in logical coordinates, the rectangle. /// /// /// Type: UINT /// /// UINT that specifies the type of inner and outer edges to draw. This parameter must be a combination of one inner-border /// flag and one outer-border flag, or one of the combination flags. The border flags are: /// /// /// /// /// Value /// Meaning /// /// /// BDR_RAISEDINNER /// Raised inner edge /// /// /// BDR_SUNKENINNER /// Sunken inner edge /// /// /// BDR_RAISEDOUTER /// Raised outer edge /// /// /// BDR_SUNKENOUTER /// Sunken outer edge /// /// /// EDGE_BUMP /// Combination of BDR_RAISEDOUTER and BDR_SUNKENINNER /// /// /// EDGE_ETCHED /// Combination of BDR_SUNKENOUTER and BDR_RAISEDINNER /// /// /// EDGE_RAISED /// Combination of BDR_RAISEDOUTER and BDR_RAISEDINNER /// /// /// EDGE_SUNKEN /// Combination of BDR_SUNKENOUTER and BDR_SUNKENINNER /// /// /// /// /// /// Type: UINT /// UINT that specifies the type of border to draw. This parameter can be a combination of the following values. /// /// /// /// Value /// Meaning /// /// /// BF_ADJUST /// /// The rectangle pointed to by the pDestRect parameter is shrunk to exclude the edges that were drawn; otherwise the rectangle does /// not change. /// /// /// /// BF_BOTTOM /// Bottom of border rectangle. /// /// /// BF_BOTTOMLEFT /// Bottom and left side of border rectangle. /// /// /// BF_BOTTOMRIGHT /// Bottom and right side of border rectangle. /// /// /// BF_DIAGONAL /// Diagonal border. /// /// /// BF_DIAGONAL_ENDBOTTOMLEFT /// Diagonal border. The end point is the lower-left corner of the rectangle; the origin is the upper-right corner. /// /// /// BF_DIAGONAL_ENDBOTTOMRIGHT /// Diagonal border. The end point is the lower-right corner of the rectangle; the origin is the upper-left corner. /// /// /// BF_DIAGONAL_ENDTOPLEFT /// Diagonal border. The end point is the upper-left corner of the rectangle; the origin is the lower-right corner. /// /// /// BF_DIAGONAL_ENDTOPRIGHT /// Diagonal border. The end point is the upper-right corner of the rectangle; the origin is the lower-left corner. /// /// /// BF_FLAT /// Flat border. /// /// /// BF_LEFT /// Left side of border rectangle. /// /// /// BF_MIDDLE /// Interior of the rectangle is to be filled. /// /// /// BF_MONO /// One-dimensional border. /// /// /// BF_RECT /// Entire border rectangle. /// /// /// BF_RIGHT /// Right side of border rectangle. /// /// /// BF_SOFT /// Soft buttons instead of tiles. /// /// /// BF_TOP /// Top of border rectangle. /// /// /// BF_TOPLEFT /// Top and left side of border rectangle. /// /// /// BF_TOPRIGHT /// Top and right side of border rectangle. /// /// /// /// /// /// Type: LPRECT /// /// Pointer to a RECT structure that contains, in logical coordinates, the rectangle that receives the interior rectangle, if /// uFlags is set to BF_ADJUST. This parameter may be set to NULL. /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT DrawThemeEdge( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ LPCRECT pDestRect, _In_ UINT // uEdge, _In_ UINT uFlags, _Out_ LPRECT pContentRect); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773298(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773298")] public static extern HRESULT DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, in RECT pDestRect, BorderStyles3D uEdge, BorderFlags uFlags, out RECT pContentRect); /// Draws an image from an image list with the icon effect defined by the visual style. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC. /// /// /// Type: int /// Value of type int that specifies the part in which the image is drawn. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: LPCRECT /// Pointer to a RECT structure that contains, in logical coordinates, the rectangle in which the image is drawn. /// /// /// Type: HIMAGELIST /// Handle to an image list that contains the image to draw. /// /// /// Type: int /// Value of type int that specifies the index of the image to draw. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT DrawThemeIcon( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ LPCRECT pRect, _In_ HIMAGELIST // himl, _In_ int iImageIndex); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773301(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773301")] public static extern HRESULT DrawThemeIcon(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, in RECT pRect, HIMAGELIST himl, int iImageIndex); /// Draws the part of a parent control that is covered by a partially-transparent or alpha-blended child control. /// /// Type: HWND /// The child control. /// /// /// Type: HDC /// The child control's DC. /// /// /// Type: const RECT* /// /// The area to be drawn. The rectangle is in the child window's coordinates. If this parameter is NULL, the area to be drawn /// includes the entire area occupied by the child control. /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT DrawThemeParentBackground( _In_ HWND hwnd, _In_ HDC hdc, _In_ const RECT *prc); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773306(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773306")] public static extern HRESULT DrawThemeParentBackground(HWND hwnd, HDC hdc, PRECT prc); /// /// Used by partially-transparent or alpha-blended child controls to draw the part of their parent in front of which they appear. /// Sends a WM_ERASEBKGND message followed by a WM_PRINTCLIENT. /// /// /// Type: HWND /// Handle of the child control. /// /// /// Type: HDC /// HDC of the child control. /// /// /// Type: DWORD /// Zero or more of the following values. If this value is zero, this function returns S_OK only if the parent handled WM_PRINTCLIENT. /// /// /// /// Value /// Meaning /// /// /// DTPB_WINDOWDC /// If set, hdc is assumed to be a window DC, not a client DC. /// /// /// DTPB_USECTLCOLORSTATIC /// /// If set, this function sends a WM_CTLCOLORSTATIC message to the parent and uses the brush if one is provided. Otherwise, it uses COLOR_BTNFACE. /// /// /// /// DTPB_USEERASEBKGND /// If set, this function returns S_OK without sending a WM_CTLCOLORSTATIC message if the parent actually painted on WM_ERASEBKGND. /// /// /// /// /// /// Type: const RECT* /// /// Optional. The area to be drawn, in child coordinates. If this parameter is NULL, the area to be drawn includes the entire area /// occupied by the child control. /// /// /// /// Type: HRESULT /// S_OK if successful; otherwise, S_FALSE. /// // HRESULT DrawThemeParentBackgroundEx( _In_ HWND hwnd, _In_ HDC hdc, _In_ DWORD dwFlags, _In_ const RECT *prc); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773309(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773309")] public static extern HRESULT DrawThemeParentBackgroundEx(HWND hwnd, HDC hdc, DrawThemeParentBackgroundFlags dwFlags, PRECT prc); /// Draws text using the color and font defined by the visual style. /// /// Type: HTHEME /// Handle to a window's theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to use for drawing. /// /// /// Type: int /// /// The control part that has the desired text appearance. See Parts and States. If this value is 0, the text is drawn in the default /// font, or a font selected into the device context. /// /// /// /// Type: int /// The control state that has the desired text appearance. See Parts and States. /// /// /// Type: LPCWSTR /// Pointer to a string that contains the text to draw. /// /// /// Type: int /// /// Value of type int that contains the number of characters to draw. If the parameter is set to -1, all the characters in the /// string are drawn. /// /// /// /// Type: DWORD /// /// DWORD that contains one or more values that specify the string's formatting. See Format Values for possible parameter values. /// /// /// /// Type: DWORD /// Not used. Set to zero. /// /// /// Type: LPCRECT /// /// Pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the text is to be drawn. It is /// recommended to use pExtentRect from GetThemeTextExtent to retrieve the correct coordinates. /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT DrawThemeText( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ LPCWSTR pszText, _In_ int // iCharCount, _In_ DWORD dwTextFlags, _In_ DWORD dwTextFlags2, _In_ LPCRECT pRect); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773312(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773312")] public static extern HRESULT DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, string pszText, int iCharCount, DrawTextFlags dwTextFlags, [Optional] int dwTextFlags2, in RECT pRect); /// /// Draws text using the color and font defined by the visual style. Extends DrawThemeText by allowing additional text format options. /// /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to use for drawing. /// /// /// Type: int /// /// The control part that has the desired text appearance. See Parts and States. If this value is 0, the text is drawn in the default /// font, or a font selected into the device context. /// /// /// /// Type: int /// The control state that has the desired text appearance. See Parts and States. /// /// /// Type: LPCWSTR /// Pointer to a string that contains the text to draw. /// /// /// Type: int /// /// Value of type int that contains the number of characters to draw. If the parameter is set to -1, all the characters in the /// string are drawn. /// /// /// /// Type: DWORD /// /// DWORD that contains one or more values that specify the string's formatting. See Format Values for possible parameter values. /// /// /// /// Type: LPRECT /// Pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the text is to be drawn. /// /// /// Type: const DTTOPTS* /// A DTTOPTS structure that defines additional formatting options that will be applied to the text being drawn. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT DrawThemeTextEx( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ LPCWSTR pszText, _In_ int // iCharCount, _In_ DWORD dwFlags, _Inout_ LPRECT pRect, _In_ const DTTOPTS *pOptions); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773317(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773317")] public static extern HRESULT DrawThemeTextEx(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, string pszText, int iCharCount, DrawTextFlags dwFlags, ref RECT pRect, in DTTOPTS pOptions); /// Enables or disables the visual style of the background of a dialog window. /// /// Type: HWND /// Window handle of the target dialog box. /// /// /// Type: DWORD /// One of the following option flag values: /// /// /// /// Value /// Meaning /// /// /// ETDT_DISABLE /// Disables background texturing. /// /// /// ETDT_ENABLE /// Enables dialog window background texturing. The texturing is defined by a visual style. /// /// /// ETDT_USETABTEXTURE /// Uses the Tab control texture for the background texture of a dialog window. /// /// /// ETDT_USEAEROWIZARDTABTEXTURE /// Uses the Aero wizard texture for the background texture of a dialog window. /// /// /// ETDT_ENABLETAB /// /// Enables dialog window background texturing. The texture is the Tab control texture defined by the visual style. This flag is /// equivalent to (ETDT_ENABLE | ETDT_USETABTEXTURE). /// /// /// /// ETDT_ENABLEAEROWIZARDTAB /// ETDT_ENABLE | ETDT_USEAEROWIZARDTABTEXTURE. /// /// /// ETDT_VALIDBITS /// ETDT_DISABLE | ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_USEAEROWIZARDTABTEXTURE. /// /// /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT EnableThemeDialogTexture( _In_ HWND hwnd, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773320(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773320")] public static extern HRESULT EnableThemeDialogTexture(HWND hwnd, ThemeDialogTextureFlags dwFlags); /// /// /// Windows Vista through Windows 7: Enables or disables visual styles for the current user in the current and later sessions. /// /// Windows 8 and later: This function does nothing. Visual styles are always enabled in Windows 8 and later. /// /// /// Type: BOOL /// Receives one of the following values. /// /// /// /// Value /// Meaning /// /// /// TRUE /// Enables visual styles. If the user previously had an active visual style, it becomes active again. /// /// /// FALSE /// Disables visual styles and turns visual styles off. /// /// /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT EnableTheming( _In_ BOOL fEnable); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773324(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773324")] public static extern HRESULT EnableTheming([MarshalAs(UnmanagedType.Bool)] bool fEnable); /// Retrieves the name of the current visual style, and optionally retrieves the color scheme name and size name. /// /// Type: LPWSTR /// Pointer to a string that receives the theme path and file name. /// /// /// Type: int /// Value of type int that contains the maximum number of characters allowed in the theme file name. /// /// /// Type: LPWSTR /// Pointer to a string that receives the color scheme name. This parameter may be set to NULL. /// /// /// Type: int /// Value of type int that contains the maximum number of characters allowed in the color scheme name. /// /// /// Type: LPWSTR /// Pointer to a string that receives the size name. This parameter may be set to NULL. /// /// /// Type: int /// Value of type int that contains the maximum number of characters allowed in the size name. /// /// /// Type: HRESULT /// Returns S_OK if successful, otherwise an error code. /// // HRESULT GetCurrentThemeName( _Out_ LPWSTR pszThemeFileName, _In_ int dwMaxNameChars, _Out_ LPWSTR pszColorBuff, _In_ int // cchMaxColorChars, _Out_ LPWSTR pszSizeBuff, _In_ int cchMaxSizeChars); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773365(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773365")] public static extern HRESULT GetCurrentThemeName([MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszThemeFileName, int dwMaxNameChars, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszColorBuff, int cchMaxColorChars, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszSizeBuff, int cchMaxSizeChars); /* /// Gets the string containing the name of an element like ‘StartBackground’ or ‘StartDesktopTilesBackground’. /// The index. /// [PInvokeData("UxTheme.h")] [DllImport(Lib.UxTheme, ExactSpelling = true, EntryPoint = "#100")] [return: MarshalAs(UnmanagedType.LPWStr)] public static extern string GetImmersiveColorNamedTypeByIndex(uint index); [PInvokeData("UxTheme.h")] [DllImport(Lib.UxTheme, ExactSpelling = true, EntryPoint = "#94")] public static extern uint GetImmersiveColorSetCount(); /// Gets the immersive color from color set ex. /// The color set ID (between 0 and 24 for Windows 8) /// The color type (e.g. 0 for 'StartBackground'). /// /// Determines whether high contrast mode should be ignored – set it to true to retrieve the active color set's colors even /// when high contrast mode is enabled. /// /// /// Set to 1 to force UxTheme to check whether the system is in high contrast mode even with it already thinks it is (this check /// would otherwise only occur if high contrast mode had previously not been enabled). /// /// [DllImport(Lib.UxTheme, ExactSpelling = true, EntryPoint = "#95")] public static extern COLORREF GetImmersiveColorFromColorSetEx(uint dwImmersiveColorSet, uint dwImmersiveColorType, [MarshalAs(UnmanagedType.Bool)] bool bIgnoreHighContrast, uint dwHighContrastCacheMode); /// Gets the name of the immersive color type from. /// /// Prepend 'Immersive' to the string first, or the function will fail ('StartBackground' becomes 'ImmersiveStartBackground', for example). /// /// [DllImport(Lib.UxTheme, ExactSpelling = true, EntryPoint = "#96")] public static extern uint GetImmersiveColorTypeFromName([MarshalAs(UnmanagedType.LPWStr)] string pName); /// Gets the immersive user color set preference. /// /// true to force UxTheme to read the value stored in the registry (and update the system setting if what’s in the registry is /// different to what’s in memory). /// /// /// Setting it to true will stop the function attempting to retrieve the user preference a second time if the first call returns –1. /// May only be relevant in the event that UxTheme doesn’t have permission to update the system setting with the value from the registry. /// /// [DllImport(Lib.UxTheme, ExactSpelling = true, EntryPoint = "#98")] public static extern uint GetImmersiveUserColorSetPreference([MarshalAs(UnmanagedType.Bool)] bool bForceCheckRegistry, [MarshalAs(UnmanagedType.Bool)] bool bSkipCheckOnFail); */ /// Gets a theme animation property basedon the storyboard id and the target id. /// An opened theme handle. /// A predefined storyboard identifier. /// A predefined target identifier. /// The property that is associated with the animation storyboard and target. /// The buffer to receive the returned property value. /// The byte size of a buffer that is pointed by pvProperty. /// The byte size of the returned property. /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. // HRESULT THEMEAPI GetThemeAnimationProperty( _In_ HTHEME hTheme, _In_ int iStoryboardId, _In_ int iTargetId, _In_ TA_PROPERTY // eProperty, _Out_ VOID // *pvProperty, _In_ DWORD cbSize, _Out_ DWORD pcbSizeOut); https://msdn.microsoft.com/en-us/library/windows/desktop/hh404183(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "hh404183")] public static extern HRESULT GetThemeAnimationProperty(HTHEME hTheme, int iStoryboardId, int iTargetId, TA_PROPERTY eProperty, IntPtr pvProperty, uint cbSize, out uint pcbSizeOut); /// Gets an animation transform operationbased on storyboard id, target id and transformindex. /// An opened theme handle. /// A predefined storyboard identifier. /// A predefined target identifier. /// The zero-based index of a transform operation. /// A pointer to a buffer to receive a transform structure. /// The byte size of the buffer pointed by pTransform. /// The byte size of a transform operation structure. /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. // HRESULT THEMEAPI GetThemeAnimationTransform( _In_ HTHEME hTheme, _In_ int iStoryboardId, _In_ int iTargetId, _In_ DWORD // dwTransformIndex, _Out_ TA_TRANSFORM *pTransform, _In_ DWORD cbSize, _Out_ DWORD pcbSizeOut); https://msdn.microsoft.com/en-us/library/windows/desktop/hh404186(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "hh404186")] public static extern HRESULT GetThemeAnimationTransform(HTHEME hTheme, int iStoryboardId, int iTargetId, uint dwTransformIndex, out TA_TRANSFORM pTransform, uint cbSize, out uint pcbSizeOut); /// Retrieves the property flags that control how visual styles are applied in the current application. /// /// Type: DWORD /// The following return values are bit flags combined with a logical OR operator. /// /// /// /// Return code /// Description /// /// /// STAP_ALLOW_NONCLIENT /// Specifies that the nonclient areas of application windows have visual styles applied. /// /// /// STAP_ALLOW_CONTROLS /// Specifies that controls in application windows have visual styles applied. /// /// /// STAP_ALLOW_WEBCONTENT /// Specifies that all web content displayed in an application is rendered using visual styles. /// /// /// /// // DWORD GetThemeAppProperties(void); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773369(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773369")] public static extern ThemeAppProperties GetThemeAppProperties(); /// Retrieves the size of the content area for the background defined by the visual style. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to use when drawing. This parameter may be set to NULL. /// /// /// Type: int /// Value of type int that specifies the part that contains the content area. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part that contains the content area. See Parts and States. /// /// /// Type: LPCRECT /// /// Pointer to a RECT structure that contains the total background rectangle, in logical coordinates. This is the area inside /// the borders or margins. /// /// /// /// Type: LPRECT /// /// Pointer to a RECT structure that receives the content area background rectangle, in logical coordinates. This rectangle is /// calculated to fit the content area. /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeBackgroundContentRect( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ LPCRECT // pBoundingRect, _Out_ LPRECT pContentRect); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773375(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773375")] public static extern HRESULT GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, in RECT pBoundingRect, out RECT pContentRect); /// Calculates the size and location of the background, defined by the visual style, given the content area. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to use when drawing. This parameter may be set to NULL. /// /// /// Type: int /// Value of type int that specifies the part that contains the content. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part that contains the content. See Parts and States. /// /// /// Type: LPCRECT /// /// Pointer to a RECT structure that contains the content background rectangle, in logical coordinates. This rectangle is /// returned from GetThemeBackgroundContentRect. /// /// /// /// Type: LPRECT /// /// Pointer to a RECT structure that receives the background rectangle, in logical coordinates. This rectangle is based on the pContentRect. /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeBackgroundExtent( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ LPCRECT // pContentRect, _Out_ LPRECT pExtentRect); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773380(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773380")] public static extern HRESULT GetThemeBackgroundExtent(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, in RECT pContentRect, out RECT pExtentRect); /// Computes the region for a regular or partially transparent background that is bounded by a specified rectangle. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to draw into. The DC uses dots per inch (DPI) scaling. This parameter may be set to NULL. /// /// /// Type: int /// Value of type int that specifies the part that contains the region. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: LPCRECT /// /// Pointer to a RECT structure that contains, in logical coordinates, the specified rectangle used to compute the region. /// /// /// /// Type: HRGN* /// Pointer to the handle to the computed region. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeBackgroundRegion( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ LPCRECT pRect, _Out_ // HRGN *pRegion); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773384(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773384")] public static extern HRESULT GetThemeBackgroundRegion(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, in RECT pRect, out SafeHRGN pRegion); /// Retrieves the bitmap associated with a particular theme, part, state, and property. /// /// Type: HTHEME /// A handle to theme data. /// /// /// Type: int /// The part that contains the bitmap. See Parts and States. /// /// /// Type: int /// The state of the part. /// /// /// Type: int /// /// The property to retrieve. Pass zero to automatically select the first available bitmap for this part and state, or use one of the /// following values. /// /// /// /// /// Value /// Meaning /// /// /// TMT_DIBDATA /// The background image. /// /// /// TMT_GLYPHDIBDATA /// The glyph image drawn on top of the background, if present. /// /// /// TMT_HBITMAP /// Not currently supported. /// /// /// /// /// /// Type: ULONG /// The flags that specify how the bitmap is to be retrieved. Can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// GBF_DIRECT /// Retrieves a handle to the existing bitmap. /// /// /// GBF_COPY /// Retrieves a copy of the bitmap. /// /// /// GBF_VALIDBITS /// GBF_DIRECT | GBF_COPY /// /// /// /// /// /// Type: HBITMAP* /// A pointer that receives a handle to the requested bitmap. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeBitmap( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _In_ ULONG dwFlags, _Out_ // HBITMAP *phBitmap); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773388(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773388")] public static extern HRESULT GetThemeBitmap(HTHEME hTheme, int iPartId, int iStateId, int iPropId, GBF dwFlags, out SafeHBITMAP phBitmap); /// Retrieves the value of a BOOL property from the SysMetrics section of theme data. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part containing the BOOL property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. May be one of the following values. /// /// /// /// Value /// Meaning /// /// /// TMT_TRANSPARENT /// /// TRUE if the image associated with the part and state have transparent areas. See GetThemeColor for the definition of the /// TMT_TRANSPARENTCOLOR value that defines the transparent color. /// /// /// /// TMT_AUTOSIZE /// TRUE if the nonclient caption area associated with the part and state vary with text width. /// /// /// TMT_BORDERONLY /// TRUE if the image associated with the part and state should only have its border drawn. /// /// /// TMT_COMPOSITED /// TRUE if the control associated with the part and state will handle its own compositing of images. /// /// /// TMT_BGFILL /// TRUE if true-sized images associated with this part and state are to be drawn on the background fill. /// /// /// TMT_GLYPHTRANSPARENT /// /// TRUE if the glyph associated with this part and state have transparent areas. See GetThemeColor for the definition of the /// TMT_GLYPHCOLOR value that defines the transparent color. /// /// /// /// TMT_GLYPHONLY /// TRUE if the glyph associated with this part and state should be drawn without a background. /// /// /// TMT_ALWAYSSHOWSIZINGBAR /// TRUE if the sizing bar associated with this part and state should always be shown. /// /// /// TMT_MIRRORIMAGE /// /// TRUE if the image associated with this part and state should be flipped if the window is being viewed in right-to-left reading mode. /// /// /// /// TMT_UNIFORMSIZING /// TRUE if the image associated with this part and state must have equal height and width. /// /// /// TMT_INTEGRALSIZING /// TRUE if the truesize image or border associated with this part and state must be sized to a factor of 2. /// /// /// TMT_SOURCEGROW /// TRUE if the image associated with this part and state will scale larger in size if necessary. /// /// /// TMT_SOURCESHRINK /// TRUE if the image associated with this part and state will scale smaller in size if necessary. /// /// /// TMT_USERPICTURE /// TRUE if the image associated with this part and state is based on the current user. /// /// /// /// /// /// Type: BOOL* /// Pointer to a BOOL that receives the retrieved property value. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeBool( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ BOOL *pfVal); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773392(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773392")] public static extern HRESULT GetThemeBool(HTHEME hTheme, int iPartId, int iStateId, int iPropId, [MarshalAs(UnmanagedType.Bool)] out bool pfVal); /// Retrieves the value of a color property. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part that contains the color property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. For a list of possible values, see Property Identifiers. /// /// /// Type: COLORREF* /// Pointer to a COLORREF structure that receives the color value. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeColor( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ COLORREF *pColor); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773397(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773397")] public static extern HRESULT GetThemeColor(HTHEME hTheme, int iPartId, int iStateId, int iPropId, out COLORREF pColor); /// Retrieves the value for a theme property from the documentation section of the specified theme file. /// /// Type: LPCWSTR /// Pointer to a string that contains the name of the theme file that will be opened to query for the property. /// /// /// Type: LPCWSTR /// Pointer to a string that contains the name of the theme property to query. Can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// SZ_THDOCPROP_DISPLAYNAME /// Retrieves the display name of the theme. /// /// /// SZ_THDOCPROP_TOOLTIP /// Retrieves the tooltip associated with this theme. /// /// /// SZ_THDOCPROP_AUTHOR /// Retrieves the name of the author of the theme. /// /// /// SZ_THDOCPROP_CANONICALNAME /// Retrieves the name of the theme. /// /// /// /// /// /// Type: LPWSTR /// Pointer to a string buffer that receives the property string value. /// /// /// Type: int /// Value of type int that specifies the maximum number of characters that pszValueBuff can contain. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeDocumentationProperty( _In_ LPCWSTR pszThemeName, _In_ LPCWSTR pszPropertyName, _Out_ LPWSTR pszValueBuff, _In_ // int cchMaxValChars); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773402(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773402")] public static extern HRESULT GetThemeDocumentationProperty(string pszThemeName, string pszPropertyName, StringBuilder pszValueBuff, int cchMaxValChars); /// Retrieves the value of an enumerated type property. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part that contains the enumerated type property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. For a list of possible values, see Property Identifiers. /// /// /// Type: int* /// Pointer to an int that receives the enumerated type value. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeEnumValue( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ int *piVal); https://msdn.microsoft.com/en-us/library/windows/desktop/bb773406(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb773406")] public static extern HRESULT GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId, int iPropId, out int piVal); /// Retrieves the value of a filename property. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part that contains the filename property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. For a list of possible values, see Property Identifiers. /// /// /// Type: LPWSTR /// Pointer to a buffer that receives the retrieved file name. /// /// /// Type: int /// Value of type int that receives the maximum number of characters in the file name /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeFilename( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ LPWSTR // pszThemeFilename, _In_ int cchMaxBuffChars); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759743(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759743")] public static extern HRESULT GetThemeFilename(HTHEME hTheme, int iPartId, int iStateId, int iPropId, StringBuilder pszThemeFilename, int cchMaxBuffChars); /// Retrieves the value of an int property. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part that contains the int property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. For a list of possible values, see Property Identifiers. /// /// /// Type: int* /// Pointer to an int that receives the retrieved value. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeInt( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ int *piVal); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759749(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759749")] public static extern HRESULT GetThemeInt(HTHEME hTheme, int iPartId, int iStateId, int iPropId, out int piVal); /// Retrieves a list of int data from a visual style. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part that contains the list of data to return. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. See Property Identifiers. /// /// An array of integers. public static int[] GetThemeIntList(HTHEME hTheme, int partId, int stateId, int propId) { if (Environment.OSVersion.Version.Major < 6) { if (0 != GetThemeIntListPreVista(hTheme, partId, stateId, propId, out var l)) return null; var outlist = new int[l.iValueCount]; Array.Copy(l.iValues, outlist, l.iValueCount); return outlist; } else { if (0 != GetThemeIntList(hTheme, partId, stateId, propId, out var l)) return null; var outlist = new int[l.iValueCount]; Array.Copy(l.iValues, outlist, l.iValueCount); return outlist; } } /// Retrieves a list of int data from a visual style. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part that contains the list of data to return. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. See Property Identifiers. /// /// /// Type: INTLIST* /// Pointer to an INTLIST structure that receives the int data. /// /// /// Type: HRESULT /// Returns S_OK if successful, otherwise an error code. /// // HRESULT GetThemeIntList( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ INTLIST *pIntList); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759752(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("UxTheme.h", MSDNShortId = "bb759752", MinClient = PInvokeClient.WindowsVista)] public static extern HRESULT GetThemeIntList(HTHEME hTheme, int iPartId, int iStateId, int iPropId, out INTLIST pIntList); /// Retrieves the value of a MARGINS property. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to select fonts into. This parameter may be set to NULL. /// /// /// Type: int /// Value of type int that specifies the part that contains the MARGINS property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. For a list of possible values, see Property Identifiers. /// /// /// Type: LPRECT /// /// Pointer to a RECT structure that contains the rectangle that specifies the area to be drawn into. This parameter may be /// set to NULL. /// /// /// /// Type: MARGINS* /// Pointer to a MARGINS structure that receives the retrieved value. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeMargins( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _In_ LPRECT prc, // _Out_ MARGINS // *pMargins); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759755(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759755")] public static extern HRESULT GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, PRECT prc, out MARGINS pMargins); /// Retrieves the value of a metric property. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC. This parameter may be set to NULL. /// /// /// Type: int /// Value of type int that specifies the part that contains the metric property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. Can be one of the following values. /// /// /// /// Value /// Meaning /// /// /// TMT_ALPHALEVEL /// The alpha value (0-255) used for DrawThemeIcon. /// /// /// TMT_ALPHATHRESHOLD /// The minimum alpha value (0-255) that a pixel must be to be considered opaque. /// /// /// TMT_BORDERSIZE /// The thickness of the border drawn if this part uses a border fill. /// /// /// TMT_GLYPHINDEX /// The character index into the selected font that will be used for the glyph, if the part uses a font-based glyph. /// /// /// TMT_GRADIENTRATIO1 /// /// The amount of the first gradient color to use in drawing the part. This value can be from 0 to 255, but this value plus the /// values of each of the GRADIENTRATIO values must add up to 255. See the TMT_GRADIENTCOLOR1 value of GetThemeColor. /// /// /// /// TMT_GRADIENTRATIO2 /// The amount of the second gradient color to use in drawing the part. /// /// /// TMT_GRADIENTRATIO3 /// The amount of the third gradient color to use in drawing the part. /// /// /// TMT_GRADIENTRATIO4 /// The amount of the fourth gradient color to use in drawing the part. /// /// /// TMT_GRADIENTRATIO5 /// The amount of the fifth gradient color to use in drawing the part. /// /// /// TMT_HEIGHT /// The height of the part. /// /// /// TMT_IMAGECOUNT /// The number of state images present in an image file. /// /// /// TMT_MINDPI1 /// The minimum dpi that the first image file was designed for. See GetThemeFilename. /// /// /// TMT_MINDPI2 /// The minimum dpi that the second image file was designed for. /// /// /// TMT_MINDPI3 /// The minimum dpi that the third image file was designed for. /// /// /// TMT_MINDPI4 /// The minimum dpi that the fourth image file was designed for. /// /// /// TMT_MINDPI5 /// The minimum dpi that the fifth image file was designed for. /// /// /// TMT_PROGRESSCHUNKSIZE /// The size of the progress control &quot;chunk&quot; shapes that define how far an operation has progressed. /// /// /// TMT_PROGRESSSPACESIZE /// The total size of all of the progress control &quot;chunks&quot;. /// /// /// TMT_ROUNDCORNERWIDTH /// The roundness (0-100%) of the part's corners. /// /// /// TMT_ROUNDCORNERHEIGHT /// The roundness (0-100%) of the part's corners. /// /// /// TMT_SATURATION /// The amount of saturation (0-255) to apply to an icon drawn using DrawThemeIcon. /// /// /// TMT_TEXTBORDERSIZE /// The thickness of the border drawn around text characters. /// /// /// TMT_TRUESIZESTRETCHMARK /// The percentage of a true-size image's original size at which the image will be stretched. /// /// /// TMT_WIDTH /// The width of the part. /// /// /// /// /// /// Type: int* /// Pointer to an int that receives the metric property value. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeMetric( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ int // *piVal); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759757(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759757")] public static extern HRESULT GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, out int piVal); /// Calculates the original size of the part defined by a visual style. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to select fonts into. /// /// /// Type: int /// Value of type int that specifies the part to calculate the size of. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: LPCRECT /// /// Pointer to a RECT structure that contains the rectangle used for the part drawing destination. This parameter may be set /// to NULL. /// /// /// /// Type: THEMESIZE /// Enumerated type that specifies the type of size to retrieve. See THEMESIZE for a list of type values. /// /// /// Type: SIZE* /// Pointer to a SIZE structure that receives the dimensions of the specified part. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemePartSize( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ LPCRECT prc, _In_ THEMESIZE // eSize, _Out_ SIZE // *psz); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759759(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759759")] public static extern HRESULT GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, PRECT prc, THEMESIZE eSize, out SIZE psz); /// Retrieves the value of a position property. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part that contains the position property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. For a list of possible values, see Property Identifiers. /// /// /// Type: POINT* /// Pointer to a POINT structure that receives the position value. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemePosition( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ POINT *pPoint); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759762(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759762")] public static extern HRESULT GetThemePosition(HTHEME hTheme, int iPartId, int iStateId, int iPropId, out Point pPoint); /// Retrieves the location of the theme property definition for a property. /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// Value of type int that specifies the part that contains the theme. See Parts and States. /// Value of type int that specifies the state of the part. See Parts and States. /// /// Value of type int that specifies the property to retrieve. You may use any of the property values from Vssym32.h. These values /// are described in the reference pages for the functions that use them. For instance, the GetThemeInt function uses the /// TMT_BORDERSIZE value. See the Visual Styles Reference for a list of functions. /// /// Pointer to a PROPERTYORIGIN enumerated type that indicates where the property was or was not found. /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759764")] public static extern HRESULT GetThemePropertyOrigin(HTHEME hTheme, int iPartId, int iStateId, int iPropId, out PROPERTYORIGIN pOrigin); /// Retrieves the value of a RECT property. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part containing the RECT property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. For a list of possible values, see Property Identifiers. /// /// /// Type: LPRECT /// Pointer to a RECT structure that receives a rectangle. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeRect( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ LPRECT pRect); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759766(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759766")] public static extern HRESULT GetThemeRect(HTHEME hTheme, int iPartId, int iStateId, int iPropId, out RECT pRect); /// Retrieves a data stream corresponding to a specified theme, starting from a specified part, state, and property. /// /// Type: HTHEME /// Handle to the theme from which the stream will be retrieved. /// /// /// Type: int /// Specifies the part to retrieve a stream from. See Parts and States. /// /// /// Type: int /// Specifies the state of the part. /// /// /// Type: int /// Specifies the property to retrieve. /// /// /// Type: VOID** /// Address of a pointer that receives the stream. /// /// /// Type: DWORD* /// Pointer that receives the length, in bytes, of the stream received by ppvStream. /// /// /// Type: HINSTANCE /// /// If iPropId is TMT_STREAM, this value is NULL. If iPropId is TMT_DISKSTREAM, this value is the HINSTANCE of a loaded styles file. /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeStream( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ VOID **ppvStream, _Out_ // DWORD *pcbStream, _In_ HINSTANCE hInst); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759768(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759768")] public static extern HRESULT GetThemeStream(HTHEME hTheme, int iPartId, int iStateId, int iPropId, out IntPtr ppvStream, out uint pcbStream, HINSTANCE hInst); /// Retrieves the value of a string property. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part containing the string property. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. For a list of possible values, see Property Identifiers. /// /// /// Type: LPWSTR /// Pointer to a buffer that receives the string value. /// /// /// Type: int /// Value of type int that specifies the maximum number of characters pszBuff can contain. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeString( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ LPWSTR pszBuff, _In_ int // cchMaxBuffChars); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759770(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759770")] public static extern HRESULT GetThemeString(HTHEME hTheme, int iPartId, int iStateId, int iPropId, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszBuff, int cchMaxBuffChars); /// Retrieves the Boolean value of a system metric. /// /// Type: HTHEME /// Handle to theme data. /// /// /// Type: int /// Value of type int that specifies the system Boolean metric desired. May be the following value. /// /// /// /// Value /// Meaning /// /// /// TMT_FLATMENUS /// Describes how menus are drawn. If TRUE, menus are drawn without shadows. If FALSE, menus have shadows underneath them. /// /// /// /// /// /// Type: BOOL /// Value of desired system metric. /// // BOOL GetThemeSysBool( _In_ HTHEME hTheme, _In_ int iBoolID); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759773(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759773")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetThemeSysBool(HTHEME hTheme, int iBoolID); /// Retrieves the value of a system color. /// /// Type: HTHEME /// Handle to theme data. /// /// /// Type: int /// /// Value of type int that specifies the color number. May be one of the values listed in GetSysColor for the nIndex parameter. /// /// /// /// Type: COLORREF /// The value of the specified system color. /// // COLORREF GetThemeSysColor( _In_ HTHEME hTheme, _In_ int iColorID); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759776(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759776")] public static extern COLORREF GetThemeSysColor(HTHEME hTheme, SystemColorIndex iColorID); /// Retrieves a system color brush. /// /// Type: HTHEME /// Handle to theme data. /// /// /// Type: int /// Value of type int that specifies the number of the desired system color. May be one of the following values. /// /// /// /// Value /// Meaning /// /// /// TMT_SCROLLBAR /// The color of scroll bars. /// /// /// TMT_BACKGROUND /// The color of the background. /// /// /// TMT_ACTIVECAPTION /// The color of the caption area on an active window. /// /// /// TMT_INACTIVECAPTION /// The color of the caption area on an inactive window. /// /// /// TMT_WINDOW /// The color of a window. /// /// /// TMT_WINDOWFRAME /// The color of the frame around a window. /// /// /// TMT_MENUTEXT /// The color of text drawn on a menu. /// /// /// TMT_WINDOWTEXT /// The color of text drawn in a window. /// /// /// TMT_CAPTIONTEXT /// The color of text drawn in the caption area of an active window. /// /// /// TMT_ACTIVEBORDER /// The color of the border around an active window. /// /// /// TMT_INACTIVEBORDER /// The color of the border around an inactive window. /// /// /// TMT_APPWORKSPACE /// The color of the application workspace. /// /// /// TMT_HIGHLIGHT /// The color of a highlight. /// /// /// TMT_HIGHLIGHTTEXT /// The color of highlighted text. /// /// /// TMT_BTNFACE /// The color of a button face. /// /// /// TMT_BTNSHADOW /// The color of the shadow underneath a button. /// /// /// TMT_GRAYTEXT /// The color of dimmed text. /// /// /// TMT_BTNTEXT /// The color of text contained within a button. /// /// /// TMT_INACTIVECAPTIONTEXT /// The color of the text in the caption area of an inactive window. /// /// /// TMT_BTNHIGHLIGHT /// The color of the highlight around a button. /// /// /// TMT_DKSHADOW3D /// The color of three-dimensional dark shadows. /// /// /// TMT_LIGHT3D /// The color of three-dimensional light areas. /// /// /// TMT_INFOTEXT /// The color of informational text. /// /// /// TMT_INFOBK /// The color of the background behind informational text. /// /// /// TMT_BUTTONALTERNATEFACE /// The color of the alternate face of a button. /// /// /// TMT_HOTTRACKING /// The color of highlight applied when a user moves the mouse over a control. /// /// /// TMT_GRADIENTACTIVECAPTION /// The gradient color applied to the caption area of an active window. /// /// /// TMT_GRADIENTINACTIVECAPTION /// The gradient color applied to the caption area of an inactive window. /// /// /// TMT_MENUHILIGHT /// The color of highlight drawn on a menu item when the user moves the mouse over it. /// /// /// TMT_MENUBAR /// The color of the menu bar. /// /// /// /// /// /// Type: HBRUSH /// Handle to brush data. /// // HBRUSH GetThemeSysColorBrush( _In_ HTHEME hTheme, _In_ int iColorID); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759780(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759780")] public static extern SafeHBRUSH GetThemeSysColorBrush(HTHEME hTheme, int iColorID); /// Retrieves the value of a system int. /// /// Type: HTHEME /// Handle to theme data. /// /// /// Type: int /// Value of type int that specifies the desired system int. May be the following value. /// /// /// /// Value /// Meaning /// /// /// TMT_MINCOLORDEPTH /// The minimum color depth, in bits, required to properly view this style. /// /// /// /// /// /// Type: int* /// Pointer to an int that receives the system integer value. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeSysInt( _In_ HTHEME hTheme, _In_ int iIntID, _In_ int *piValue); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759787(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759787")] public static extern HRESULT GetThemeSysInt(HTHEME hTheme, int iIntID, out int piValue); /// Retrieves the value of a system size metric from theme data. /// /// Type: HTHEME /// Handle to theme data. /// /// /// Type: int /// Value of type int that specifies the system size metric desired. The following values are valid: /// /// /// /// Value /// Meaning /// /// /// SM_CXBORDER /// Specifies the width of a border. /// /// /// SM_CXVSCROLL /// Specifies the width of a scroll bar. /// /// /// SM_CXHSCROLL /// Specifies the height of a scroll bar. /// /// /// SM_CXSIZE /// Specifies the width of a caption. /// /// /// SM_CYSIZE /// Specifies the height of a caption. /// /// /// SM_CXSMSIZE /// Specifies the width of a small caption. /// /// /// SM_CYSMSIZE /// Specifies the height of a small caption. /// /// /// SM_CXMENUSIZE /// Specifies the width of a menu bar. /// /// /// SM_CYMENUSIZE /// Specifies the height of a menu bar. /// /// /// SM_CXPADDEDBORDER /// Specifies the amount of border padding for captioned windows. /// /// /// /// /// /// Type: int /// Returns the size in pixels. /// // int GetThemeSysSize( _In_ HTHEME hTheme, _In_ int iSizeID); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759790(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759790")] public static extern int GetThemeSysSize(HTHEME hTheme, int iSizeID); /// Retrieves the value of a system string. /// /// Type: HTHEME /// Handle to theme data. /// /// /// Type: int /// Value of type int that specifies a system string. May be one of the following values. /// /// /// /// Value /// Meaning /// /// /// TMT_CSSNAME /// The name of the CSS file associated with the theme specified by hTheme. /// /// /// TMT_XMLNAME /// The name of the XML file associated with the theme specified by hTheme. /// /// /// /// /// /// Type: LPWSTR /// Pointer to the buffer that receives the string value from this function. /// /// /// Type: int /// Value of type int that specifies the maximum number of characters the string buffer can hold. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeSysString( _In_ HTHEME hTheme, _In_ int iStringID, _Out_ LPWSTR pszStringBuff, _In_ int cchMaxStringChars); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759793(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759793")] public static extern HRESULT GetThemeSysString(HTHEME hTheme, int iStringID, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszStringBuff, int cchMaxStringChars); /// Calculates the size and location of the specified text when rendered in the visual style font. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to select the font into. /// /// /// Type: int /// Value of type int that specifies the part in which the text will be drawn. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: LPCWSTR /// Pointer to a string that contains the text to draw. /// /// /// Type: int /// /// Value of type int that contains the number of characters to draw. If the parameter is set to -1, all the characters in the /// string are drawn. /// /// /// /// Type: DWORD /// /// DWORD that contains one or more values that specify the string's formatting. See Format Values for possible parameter values. /// /// /// /// Type: LPCRECT /// /// Pointer to a RECT structure that contains the rectangle used to control layout of the text. This parameter may be set to NULL. /// /// /// /// Type: LPRECT /// Pointer to a RECT structure that contains, in logical coordinates, the rectangle required to fit the rendered text. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeTextExtent( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ LPCWSTR pszText, _In_ int // iCharCount, _In_ DWORD dwTextFlags, _In_ LPCRECT pBoundingRect, _Out_ LPRECT pExtentRect); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759798(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759798")] public static extern HRESULT GetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, string pszText, int iCharCount, DrawTextFlags dwTextFlags, PRECT pBoundingRect, out RECT pExtentRect); /// Retrieves information about the font specified by a visual style for a particular part. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to use for screen context. This parameter may be set to NULL. /// /// /// Type: int /// Value of type int that specifies the part to retrieve font information about. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: TEXTMETRIC* /// Receives the font information. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeTextMetrics( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _Out_ TEXTMETRIC *ptm); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759801(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759801")] public static extern HRESULT GetThemeTextMetrics(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, out TEXTMETRIC ptm); /// Gets a predefined timing function based ona timing function identifier. /// An opened theme handle. /// A timing function identifier. /// A buffer to receive a predefined timing function pointer. /// The byte size of the buffer pointed by pTimingFunction. /// The byte size ofthe timing function structure. /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. // HRESULT THEMEAPI GetThemeTimingFunction( _In_ HTHEME hTheme, _In_ int iTimingFunctionId, _Out_ TA_TIMINGFUNCTION *pTimingFunction, // _In_ DWORD cbSize, _Out_ DWORD pcbSizeOut); https://msdn.microsoft.com/en-us/library/windows/desktop/hh404194(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "hh404194")] public static extern HRESULT GetThemeTimingFunction(HTHEME hTheme, int iTimingFunctionId, IntPtr pTimingFunction, uint cbSize, out uint pcbSizeOut); /// Gets the duration for the specified transition. /// /// Type: HTHEME /// Handle of the theme data. /// /// /// Type: int /// ID of the part. /// /// /// Type: int /// State ID of the part before the transition. /// /// /// Type: int /// State ID of the part after the transition. /// /// /// Type: int /// Property ID. /// /// /// Type: DWORD* /// Address of a variable that receives the transition duration, in milliseconds. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT GetThemeTransitionDuration( HTHEME hTheme, int iPartId, int iStateIdFrom, int iStateIdTo, int iPropId, _Out_ DWORD // *pdwDuration); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759804(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759804")] public static extern HRESULT GetThemeTransitionDuration(HTHEME hTheme, int iPartId, int iStateIdFrom, int iStateIdTo, int iPropId, out uint pdwDuration); /// Retrieves a theme handle to a window that has visual styles applied. /// /// Type: HWND /// Handle of the window. /// /// /// Type: HTHEME /// The most recent theme handle from OpenThemeData. /// // HTHEME GetWindowTheme( _In_ HWND hWnd); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759806(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759806")] public static extern HTHEME GetWindowTheme(HWND hWnd); /// Retrieves a hit test code for a point in the background specified by a visual style. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: HDC /// HDC to use when drawing. This parameter may be set to NULL. /// /// /// Type: int /// Value of type int that specifies the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: DWORD /// DWORD that specifies the hit test options. See Hit Test Options for a list of options. /// /// /// Type: LPCRECT /// Pointer to a RECT structure that contains, in logical coordinates, the rectangle that bounds the background. /// /// /// Type: HRGN /// Handle to a region that can be used to specify the bounds of a hit test area. This parameter may be set to NULL. /// /// /// Type: POINT /// POINT structure that contains the coordinates of the point. /// /// /// Type: WORD* /// /// WORD that receives the hit test code that indicates whether the point in ptTest is in the background area bounded by pRect /// or hrgn. See Hit Test Return Values for a list of values returned. /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT HitTestThemeBackground( _In_ HTHEME hTheme, _In_ HDC hdc, _In_ int iPartId, _In_ int iStateId, _In_ DWORD dwOptions, _In_ // LPCRECT pRect, _In_ HRGN hrgn, _In_ POINT ptTest, _Out_ WORD *pwHitTestCode); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759808(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759808")] public static extern HRESULT HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, HitTestOptions dwOptions, in RECT pRect, HRGN hrgn, Point ptTest, out HitTestValues pwHitTestCode); /// Reports whether the current application's user interface displays using visual styles. /// /// Type: BOOL /// Returns one of the following values. /// /// /// /// Return code /// Description /// /// /// TRUE /// The application has a visual style applied. /// /// /// FALSE /// The application does not have a visual style applied. /// /// /// /// // BOOL IsAppThemed(void); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759809(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759809")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsAppThemed(); /// Determines whether Desktop Window Manager (DWM) composition effects are available to the theme. /// /// Type: BOOL /// TRUE if composition effects are available; otherwise, FALSE. /// // BOOL IsCompositionActive(void); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759811(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759811")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsCompositionActive(); /// Tests if a visual style for the current application is active. /// /// Type: BOOL /// Returns one of the following values. /// /// /// /// Return code /// Description /// /// /// TRUE /// /// A visual style is enabled, and windows with visual styles applied should call OpenThemeData to start using theme drawing services. /// /// /// /// FALSE /// /// A visual style is not enabled, and the window message handler does not need to make another call to IsThemeActive until it /// receives a WM_THEMECHANGED message. /// /// /// /// /// // BOOL IsThemeActive(void); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759813(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759813")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsThemeActive(); /// Retrieves whether the background specified by the visual style has transparent pieces or alpha-blended pieces. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: BOOL /// Returns one of the following values. /// /// /// /// Return code /// Description /// /// /// TRUE /// The theme-specified background for a particular iPartId and iStateId has transparent pieces or alpha-blended pieces. /// /// /// FALSE /// /// The theme-specified background for a particular iPartId and iStateId does not have transparent pieces or alpha-blended pieces. /// /// /// /// /// // BOOL IsThemeBackgroundPartiallyTransparent( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759815(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759815")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId); /// Reports whether a specified dialog window supports background texturing. /// /// Type: HWND /// HWND value that specifies a dialog window. /// /// /// Type: BOOL /// Returns one of the following values. /// /// /// /// Return code /// Description /// /// /// TRUE /// Background texturing is supported on the dialog window specified by the hwnd parameter. /// /// /// FALSE /// Background texturing is not supported on the dialog window specified by the hwnd parameter. /// /// /// /// // BOOL IsThemeDialogTextureEnabled( _In_ HWND hwnd); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759818(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759818")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsThemeDialogTextureEnabled(HWND hwnd); /// Retrieves whether a visual style has defined parameters for the specified part and state. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part. See Parts and States. /// /// /// Type: int /// Currently unused. The value should be 0. /// /// /// Type: BOOL /// Returns one of the following values. /// /// /// /// Return code /// Description /// /// /// TRUE /// The theme has defined parameters for the specified iPartId and iStateId /// /// /// FALSE /// The theme does not have defined parameters for the specified iPartId and iStateId /// /// /// /// // BOOL IsThemePartDefined( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759819(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759819")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId); /// Opens the theme data for a window and its associated class. /// /// Type: HWND /// Handle of the window for which theme data is required. /// /// /// Type: LPCWSTR /// Pointer to a string that contains a semicolon-separated list of classes. /// /// /// Type: HTHEME /// /// OpenThemeData tries to match each class, one at a time, to a class data section in the active theme. If a match is found, /// an associated HTHEME handle is returned. If no match is found NULL is returned. /// /// // HTHEME OpenThemeData( _In_ HWND hwnd, _In_ LPCWSTR pszClassList); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759821(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759821")] public static extern SafeHTHEME OpenThemeData(HWND hwnd, string pszClassList); /// Opens the theme data associated with a window for specified theme classes. /// /// Type: HWND /// A handle to a window or control that the theme is to be retrieved from. /// /// /// Type: LPCWSTR /// A semicolon-separated list of class names to match. /// /// /// Type: DWORD /// Optional flags that control how to return the theme data. May be set to a combination of the following values. /// /// /// /// Value /// Meaning /// /// /// OTD_FORCE_RECT_SIZING /// Forces drawn images from this theme to stretch to fit the rectangles specified by drawing functions. /// /// /// OTD_NONCLIENT /// Allows theme elements to be drawn in the non-client area of the window. /// /// /// /// /// /// Type: HTHEME /// If a match is found, a valid handle to a theme is returned. Otherwise, a NULL value will be returned. /// // HTHEME OpenThemeDataEx( _In_ HWND hwnd, _In_ LPCWSTR pszClassIdList, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759823(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759823")] public static extern SafeHTHEME OpenThemeDataEx(HWND hwnd, string pszClassIdList, OpenThemeDataOptions dwFlags); /// A variant of OpenThemeData that opens a theme handle associated with a specific DPI. /// The handle of the window for which theme data is required. /// A pointer to a string that contains a semicolon-separated list of classes. /// /// The specified DPI value with which to associate the theme handle. The function will return an error if this value is outside of /// those that correspond to the set of connected monitors. /// /// See OpenThemeData. // HTHEME WINAPI OpenThemeDataForDpi( HWDN hwnd, PCWSTR pszClassIdList, UINT dpi); https://msdn.microsoft.com/en-us/library/windows/desktop/mt807674(v=vs.85).aspx [DllImport(Lib.User32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Uxtheme.h", MSDNShortId = "mt807674")] public static extern SafeHTHEME OpenThemeDataForDpi(HWND hwnd, string pszClassIdList, uint dpi); /// Sets the flags that determine how visual styles are implemented in the calling application. /// /// Type: DWORD /// DWORD that specifies one or more of the following bit flags, which can be combined with a logical OR. /// /// /// /// Value /// Meaning /// /// /// STAP_ALLOW_NONCLIENT /// Specifies that the nonclient areas of application windows will have visual styles applied. /// /// /// STAP_ALLOW_CONTROLS /// Specifies that the common controls used in an application will have visual styles applied. /// /// /// STAP_ALLOW_WEBCONTENT /// Specifies that web content displayed in an application will have visual styles applied. /// /// /// /// /// This function does not return a value. // void SetThemeAppProperties( DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759825(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759825")] public static extern void SetThemeAppProperties(ThemeAppProperties dwFlags); /// Causes a window to use a different set of visual style information than its class normally uses. /// /// Type: HWND /// Handle to the window whose visual style information is to be changed. /// /// /// Type: LPCWSTR /// /// Pointer to a string that contains the application name to use in place of the calling application's name. If this parameter is /// NULL, the calling application's name is used. /// /// /// /// Type: LPCWSTR /// /// Pointer to a string that contains a semicolon-separated list of CLSID names to use in place of the actual list passed by the /// window's class. If this parameter is NULL, the ID list from the calling class is used. /// /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT SetWindowTheme( _In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759827(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759827")] public static extern HRESULT SetWindowTheme(HWND hwnd, string pszSubAppName, string pszSubIdList); /// Sets attributes to control how visual styles are applied to a specified window. /// /// Type: HWND /// Handle to a window to apply changes to. /// /// /// Type: enum WINDOWTHEMEATTRIBUTETYPE /// /// Value of type WINDOWTHEMEATTRIBUTETYPE that specifies the type of attribute to set. The value of this parameter determines /// the type of data that should be passed in the pvAttribute parameter. Can be the following value. /// /// /// /// /// Value /// Meaning /// /// /// WTA_NONCLIENT /// Specifies non-client related attributes. pvAttribute must be a pointer of type WTA_OPTIONS. /// /// /// /// /// /// Type: PVOID /// A pointer that specifies attributes to set. Type is determined by the value of the eAttribute value. /// /// /// Type: DWORD /// Specifies the size, in bytes, of the data pointed to by pvAttribute. /// /// /// Type: HRESULT /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// // HRESULT SetWindowThemeAttribute( _In_ HWND hwnd, _In_ enum WINDOWTHEMEATTRIBUTETYPE eAttribute, _In_ PVOID pvAttribute, _In_ DWORD // cbAttribute); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759829(v=vs.85).aspx [DllImport(Lib.UxTheme, SetLastError = false, ExactSpelling = true)] [PInvokeData("Uxtheme.h", MSDNShortId = "bb759829")] public static extern HRESULT SetWindowThemeAttribute(HWND hwnd, WINDOWTHEMEATTRIBUTETYPE eAttribute, in WTA_OPTIONS pvAttribute, uint cbAttribute); /// Sets attributes to control how visual styles are applied to a specified window. /// Handle to a window to apply changes to. /// A combination of flags that modify window visual style attributes. /// if set to true add the flag to the window attributes, otherwise remove the flag. public static void SetWindowThemeNonClientAttributes(HWND hWnd, WTNCA ncAttrs, bool activate = true) { var opt = new WTA_OPTIONS { Flags = ncAttrs, Mask = activate ? (uint)ncAttrs : 0 }; SetWindowThemeAttribute(hWnd, WINDOWTHEMEATTRIBUTETYPE.WTA_NONCLIENT, opt, (uint)Marshal.SizeOf(opt)).ThrowIfFailed(); } /// Retrieves a list of int data from a visual style. /// /// Type: HTHEME /// Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME. /// /// /// Type: int /// Value of type int that specifies the part that contains the list of data to return. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the state of the part. See Parts and States. /// /// /// Type: int /// Value of type int that specifies the property to retrieve. See Property Identifiers. /// /// /// Type: INTLIST* /// Pointer to an INTLIST structure that receives the int data. /// /// /// Type: HRESULT /// Returns S_OK if successful, otherwise an error code. /// // HRESULT GetThemeIntList( _In_ HTHEME hTheme, _In_ int iPartId, _In_ int iStateId, _In_ int iPropId, _Out_ INTLIST *pIntList); https://msdn.microsoft.com/en-us/library/windows/desktop/bb759752(v=vs.85).aspx [PInvokeData("UxTheme.h", MSDNShortId = "bb759752")] [DllImport(Lib.UxTheme, SetLastError = false, EntryPoint = "GetThemeIntList")] private static extern HRESULT GetThemeIntListPreVista(HTHEME hTheme, int iPartId, int iStateId, int iPropId, out INTLIST_OLD pIntList); /// Defines the options for the function. /// Defines the options for the DrawThemeTextEx function. // typedef struct _DTTOPTS { DWORD dwSize; DWORD dwFlags; COLORREF crText; COLORREF crBorder; COLORREF crShadow; int iTextShadowType; // POINT ptShadowOffset; int iBorderSize; int iFontPropId; int iColorPropId; int iStateId; BOOL fApplyOverlay; int iGlowSize; // DTT_CALLBACK_PROC pfnDrawTextCallback; LPARAM lParam;} DTTOPTS, *PDTTOPTS; https://msdn.microsoft.com/en-us/library/windows/desktop/bb773236(v=vs.85).aspx [PInvokeData("Uxtheme.h", MSDNShortId = "bb773236")] [StructLayout(LayoutKind.Sequential)] public struct DTTOPTS { /// /// Type: DWORD /// Size of the structure. /// public uint dwSize; /// /// Type: DWORD /// /// A combination of flags that specify whether certain values of the DTTOPTS structure have been specified, and how to /// interpret these values. This member can be a combination of the following. /// /// /// /// /// Value /// Meaning /// /// /// DTT_TEXTCOLOR /// The crText member value is valid. /// /// /// DTT_BORDERCOLOR /// The crBorder member value is valid. /// /// /// DTT_SHADOWCOLOR /// The crShadow member value is valid. /// /// /// DTT_SHADOWTYPE /// The iTextShadowType member value is valid. /// /// /// DTT_SHADOWOFFSET /// The ptShadowOffset member value is valid. /// /// /// DTT_BORDERSIZE /// The iBorderSize member value is valid. /// /// /// DTT_FONTPROP /// The iFontPropId member value is valid. /// /// /// DTT_COLORPROP /// The iColorPropId member value is valid. /// /// /// DTT_STATEID /// The iStateId member value is valid. /// /// /// DTT_CALCRECT /// /// The pRect parameter of the DrawThemeTextEx function that uses this structure will be used as both an in and an out parameter. /// After the function returns, the pRect parameter will contain the rectangle that corresponds to the region calculated to be drawn. /// /// /// /// DTT_APPLYOVERLAY /// The fApplyOverlay member value is valid. /// /// /// DTT_GLOWSIZE /// The iGlowSize member value is valid. /// /// /// DTT_CALLBACK /// The pfnDrawTextCallback member value is valid. /// /// /// DTT_COMPOSITED /// /// Draws text with antialiased alpha. Use of this flag requires a top-down DIB section. This flag works only if the HDC passed /// to function DrawThemeTextEx has a top-down DIB section currently selected in it. For more information, see Device-Independent Bitmaps. /// /// /// /// DTT_VALIDBITS /// /// DTT_TEXTCOLOR | DTT_BORDERCOLOR | DTT_SHADOWCOLOR | DTT_SHADOWTYPE | DTT_SHADOWOFFSET | DTT_BORDERSIZE | DTT_FONTPROP | /// DTT_COLORPROP | DTT_STATEID | DTT_CALCRECT | DTT_APPLYOVERLAY | DTT_GLOWSIZE | DTT_COMPOSITED. /// /// /// /// /// public DrawThemeTextOptionsMasks dwMasks; /// /// Type: COLORREF /// Specifies the color of the text that will be drawn. /// public COLORREF crText; /// /// Type: COLORREF /// Specifies the color of the outline that will be drawn around the text. /// public COLORREF crBorder; /// /// Type: COLORREF /// Specifies the color of the shadow that will be drawn behind the text. /// public COLORREF crShadow; /// /// Type: int /// Specifies the type of the shadow that will be drawn behind the text. This member can have one of the following values. /// /// /// /// Value /// Meaning /// /// /// TST_NONE /// No shadow will be drawn. /// /// /// TST_SINGLE /// The shadow will be drawn to appear detailed underneath text. /// /// /// TST_CONTINUOUS /// The shadow will be drawn to appear blurred underneath text. /// /// /// /// public TextShadowType iTextShadowType; /// /// Type: POINT /// Specifies the amount of offset, in logical coordinates, between the shadow and the text. /// public Point ptShadowOffset; /// /// Type: int /// Specifies the radius of the outline that will be drawn around the text. /// public int iBorderSize; /// /// Type: int /// Specifies an alternate font property to use when drawing text. For a list of possible values, see GetThemeSysFont. /// public ThemeProperty iFontPropId; /// /// Type: int /// /// Specifies an alternate color property to use when drawing text. If this value is valid and the corresponding flag is set in /// dwFlags, this value will override the value of crText. See the values listed in GetSysColor for the /// nIndex parameter. /// /// public ThemeProperty iColorPropId; /// /// Type: int /// Specifies an alternate state to use. This member is not used by DrawThemeTextEx. /// public int iStateId; /// /// Type: BOOL /// /// If TRUE, text will be drawn on top of the shadow and outline effects. If FALSE, just the shadow and outline /// effects will be drawn. /// /// [MarshalAs(UnmanagedType.Bool)] public bool fApplyOverlay; /// /// Type: int /// Specifies the size of a glow that will be drawn on the background prior to any text being drawn. /// public int iGlowSize; /// /// Type: DTT_CALLBACK_PROC /// Pointer to callback function for DrawThemeTextEx. /// [MarshalAs(UnmanagedType.FunctionPtr)] public DTT_CALLBACK_PROC pfnDrawTextCallback; /// /// Type: LPARAM /// Parameter for callback back function specified by pfnDrawTextCallback. /// public IntPtr lParam; /// Initializes a new instance of the struct. /// This value must be specified to initialize. Use null. public DTTOPTS(byte? shouldBeNull) : this() => dwSize = (uint)Marshal.SizeOf(typeof(DTTOPTS)); /// Gets or sets a value that specifies an alternate color property to use when drawing text. /// The alternate color of the text. public ThemeProperty AlternateColorProperty { get => iColorPropId; set { iColorPropId = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_COLORPROP; } } /// Gets or sets an alternate font property to use when drawing text. /// The alternate font. public ThemeProperty AlternateFont { get => iFontPropId; set { iFontPropId = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_FONTPROP; } } /// /// Gets or sets a value indicating whether to draw text with antialiased alpha. Use of this flag requires a top-down DIB /// section. This flag works only if the HDC passed to function DrawThemeTextEx has a top-down DIB section currently selected in /// it. For more information, see Device-Independent Bitmaps. /// /// true if antialiased alpha; otherwise, false. public bool AntiAliasedAlpha { get => dwMasks.IsFlagSet(DrawThemeTextOptionsMasks.DTT_COMPOSITED); set => SetFlag(DrawThemeTextOptionsMasks.DTT_COMPOSITED, value); } /// /// Gets or sets a value indicating whether text will be drawn on top of the shadow and outline effects ( true) or if just /// the shadow and outline effects will be drawn ( false). /// /// true if drawn on top; otherwise, false. public bool ApplyOverlay { get => fApplyOverlay; set { fApplyOverlay = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_APPLYOVERLAY; } } /// Gets or sets the color of the outline that will be drawn around the text. /// The color of the border. public Color BorderColor { get => crBorder; set { crBorder = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_BORDERCOLOR; } } /// Gets or sets the radius of the outline that will be drawn around the text. /// The size of the border. public int BorderSize { get => iBorderSize; set { iBorderSize = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_BORDERSIZE; } } /// Gets or sets the callback function. /// The callback function. public DTT_CALLBACK_PROC Callback { get => pfnDrawTextCallback; set { pfnDrawTextCallback = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_CALLBACK; } } /// Gets or sets the size of a glow that will be drawn on the background prior to any text being drawn. /// The size of the glow. public int GlowSize { get => iGlowSize; set { iGlowSize = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_GLOWSIZE; } } /// Gets or sets the parameter for callback back function specified by . /// The parameter. public IntPtr LParam { get => lParam; set => lParam = value; } /// /// Gets or sets a value indicating whether the pRect parameter of the function that uses this /// structure will be used as both an in and an out parameter. After the function returns, the pRect parameter will contain the /// rectangle that corresponds to the region calculated to be drawn. /// /// true if returning the calculated rectangle; otherwise, false. public bool ReturnCalculatedRectangle { get => dwMasks.IsFlagSet(DrawThemeTextOptionsMasks.DTT_CALCRECT); set => SetFlag(DrawThemeTextOptionsMasks.DTT_CALCRECT, value); } /// Gets or sets the color of the shadow drawn behind the text. /// The color of the shadow. public Color ShadowColor { get => crShadow; set { crShadow = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_SHADOWCOLOR; } } /// Gets or sets the amount of offset, in logical coordinates, between the shadow and the text. /// The shadow offset. public Point ShadowOffset { get => new Point(ptShadowOffset.X, ptShadowOffset.Y); set { ptShadowOffset = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_SHADOWOFFSET; } } /// Gets or sets the type of the shadow that will be drawn behind the text. /// The type of the shadow. public TextShadowType ShadowType { get => iTextShadowType; set { iTextShadowType = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_SHADOWTYPE; } } /// Gets or sets the color of the text that will be drawn. /// The color of the text. public Color TextColor { get => crText; set { crText = value; dwMasks |= DrawThemeTextOptionsMasks.DTT_TEXTCOLOR; } } /// Gets an instance with default values set. public static DTTOPTS Default => new DTTOPTS(null); private void SetFlag(DrawThemeTextOptionsMasks f, bool value) => dwMasks = dwMasks.SetFlags(f, value); } /// Contains an array or list of int data items from a visual style. // typedef struct _INTLIST { int iValueCount; int iValues[MAX_INTLIST_COUNT];} INTLIST, *PINTLIST; https://msdn.microsoft.com/en-us/library/windows/desktop/bb773240(v=vs.85).aspx [PInvokeData("UxTheme.h", MSDNShortId = "bb773240")] [StructLayout(LayoutKind.Sequential)] public struct INTLIST { /// /// Type: int /// Number of values in the list. /// public int iValueCount; /// /// Type: int[MAX_INTLIST_COUNT] /// /// List of integers. The constant MAX_INTLIST_COUNT, by definition, is equal to 402 under Windows Vista, but only 10 under /// earlier versions of Windows. /// /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 402)] public int[] iValues; } /// Returned by the GetThemeMargins function to define the margins of windows that have visual styles applied. [PInvokeData("UxTheme.h", MSDNShortId = "bb773244")] [StructLayout(LayoutKind.Sequential)] public struct MARGINS { /// Width of the left border that retains its size. public int cxLeftWidth; /// Width of the right border that retains its size. public int cxRightWidth; /// Height of the top border that retains its size. public int cyTopHeight; /// Height of the bottom border that retains its size. public int cyBottomHeight; } /// Undocumented structured used with . [StructLayout(LayoutKind.Sequential)] public struct TA_TIMINGFUNCTION { /// The timing function type. public TA_TIMINGFUNCTION_TYPE eTimingFunctionType; } /// An animation transform operation. [StructLayout(LayoutKind.Sequential)] public struct TA_TRANSFORM { /// Undocumented. public uint dwDurationTime; /// Undocumented. public uint dwStartTime; /// Undocumented. public uint dwTimingFunctionId; /// Undocumented. public TA_TRANSFORM_FLAG eFlags; /// Undocumented. public TA_TRANSFORM_TYPE eTransformType; } /// Defines options that are used to set window visual style attributes. // typedef struct WTA_OPTIONS { DWORD dwFlags; DWORD dwMask;} WTA_OPTIONS, *PWTA_OPTIONS; https://msdn.microsoft.com/en-us/library/windows/desktop/bb773248(v=vs.85).aspx [PInvokeData("Uxtheme.h", MSDNShortId = "bb773248")] [StructLayout(LayoutKind.Sequential)] public struct WTA_OPTIONS { /// /// Type: DWORD /// A combination of flags that modify window visual style attributes. Can be a combination of the WTNCA constants. /// public WTNCA Flags; /// /// Type: DWORD /// /// A bitmask that describes how the values specified in dwFlags should be applied. If the bit corresponding to a value in /// dwFlags is 0, that flag will be removed. If the bit is 1, the flag will be added. /// /// public uint Mask; } /// Contains an array or list of int data items from a visual style. // typedef struct _INTLIST { int iValueCount; int iValues[MAX_INTLIST_COUNT];} INTLIST, *PINTLIST; https://msdn.microsoft.com/en-us/library/windows/desktop/bb773240(v=vs.85).aspx [PInvokeData("UxTheme.h", MSDNShortId = "bb773240")] [StructLayout(LayoutKind.Sequential)] private struct INTLIST_OLD { /// /// Type: int /// Number of values in the list. /// public int iValueCount; /// /// Type: int[MAX_INTLIST_COUNT] /// /// List of integers. The constant MAX_INTLIST_COUNT, by definition, is equal to 402 under Windows Vista, but only 10 under /// earlier versions of Windows. /// /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public int[] iValues; } /// Defines the options for the DrawThemeBackgroundEx function. // typedef struct _DTBGOPTS { DWORD dwSize; DWORD dwFlags; RECT rcClip;} DTBGOPTS, *PDTBGOPTS; https://msdn.microsoft.com/en-us/library/windows/desktop/bb773233(v=vs.85).aspx [PInvokeData("Uxtheme.h", MSDNShortId = "bb773233")] [StructLayout(LayoutKind.Sequential)] public class DTBGOPTS { /// /// Type: DWORD /// Size of the structure. Set this to sizeof(DTBGOPTS). /// public uint dwSize; /// /// Type: DWORD /// Flags that specify the selected options. This member can be one of the following: /// /// /// /// Value /// Meaning /// /// /// DTBG_CLIPRECT /// rcClip specifies the rectangle to which drawing is clipped. /// /// /// DTBG_DRAWSOLID /// Deprecated. Draw transparent and alpha images as solid. /// /// /// DTBG_OMITBORDER /// Do not draw the border of the part (currently this value is only supported for bgtype=borderfill). /// /// /// DTBG_OMITCONTENT /// Do not draw the content area of the part (currently this value is only supported for bgtype=borderfill). /// /// /// DTBG_COMPUTINGREGION /// Deprecated. /// /// /// DTBG_MIRRORDC /// Assume the hdc is mirrored and flip images as appropriate (currently this value is only supported for bgtype=imagefile). /// /// /// DTBG_NOMIRROR /// Do not mirror the output; even in right-to-left (RTL) layout. /// /// /// DTBG_VALIDBITS /// DTBG_CLIPRECT | DTBG_DRAWSOLID | DTBG_OMITBORDER | DTBG_OMITCONTENT | DTBG_COMPUTINGREGION | DTBG_MIRRORDC | DTBG_NOMIRROR. /// /// /// /// public DrawThemeBackgroundFlags dwFlags; /// /// Type: RECT /// A RECT that specifies the bounding rectangle of the clip region. /// public RECT rcClip; /// Initializes a new instance of the class. /// The rectangle to which drawing is clipped. public DTBGOPTS(Rectangle? clipRect) { dwSize = (uint)Marshal.SizeOf(this); ClipRectangle = clipRect; } /// Gets or sets the bounding rectangle of the clip region. /// The clip rectangle. public Rectangle? ClipRectangle { get { Rectangle r = rcClip; return r.IsEmpty ? (Rectangle?)null : r; } set { rcClip = value ?? default(RECT); SetFlag(DrawThemeBackgroundFlags.DTBG_CLIPRECT, value.HasValue); } } /// Gets or sets a value indicating whether omit drawing the border. /// true if omit border; otherwise, false. public bool OmitBorder { get => dwFlags.IsFlagSet(DrawThemeBackgroundFlags.DTBG_OMITBORDER); set => SetFlag(DrawThemeBackgroundFlags.DTBG_OMITBORDER, value); } /// Gets or sets a value indicating whether omit drawing the content area of the part. /// true if omit content area of the part; otherwise, false. public bool OmitContent { get => dwFlags.IsFlagSet(DrawThemeBackgroundFlags.DTBG_OMITCONTENT); set => SetFlag(DrawThemeBackgroundFlags.DTBG_OMITCONTENT, value); } /// Gets or sets a value indicating the hdc is mirrored and flip images as appropriate. /// true if mirrored; otherwise, false. public bool HasMirroredDC { get => dwFlags.IsFlagSet(DrawThemeBackgroundFlags.DTBG_MIRRORDC); set => SetFlag(DrawThemeBackgroundFlags.DTBG_MIRRORDC, value); } /// Gets or sets a value indicating whether to mirror the output; even in right-to-left (RTL) layout. /// true if not mirroring; otherwise, false. public bool DoNotMirror { get => dwFlags.IsFlagSet(DrawThemeBackgroundFlags.DTBG_NOMIRROR); set => SetFlag(DrawThemeBackgroundFlags.DTBG_NOMIRROR, value); } /// Performs an implicit conversion from to . /// The clipping rectangle. /// The result of the conversion. public static implicit operator DTBGOPTS(Rectangle clipRectangle) => new DTBGOPTS(clipRectangle); private void SetFlag(DrawThemeBackgroundFlags f, bool value) => dwFlags = dwFlags.SetFlags(f, value); } /// Represents a safe handle for a theme. Use in place of HTHEME. public class SafeHTHEME : HANDLE { /// Initializes a new instance of the class. /// The h theme. /// if set to true [owns handle]. public SafeHTHEME(IntPtr hTheme, bool ownsHandle = true) : base(hTheme, ownsHandle) { } private SafeHTHEME() : base() { } /// Performs an implicit conversion from to . /// The safe handle instance. /// The result of the conversion. public static implicit operator HTHEME(SafeHTHEME h) => h.handle; /// protected override bool InternalReleaseHandle() => CloseThemeData(this).Succeeded; } } }