using System; using System.Runtime.InteropServices; namespace Vanara.PInvoke { public static partial class Shell32 { /// Specifies the use of a color. Used by IVisualProperties methods. // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/ne-shobjidl-vpcolorflags typedef enum VPCOLORFLAGS { VPCF_TEXT, // VPCF_BACKGROUND, VPCF_SORTCOLUMN, VPCF_SUBTEXT, VPCF_TEXTBACKGROUND } ; [PInvokeData("shobjidl.h", MSDNShortId = "NE:shobjidl.VPCOLORFLAGS")] public enum VPCOLORFLAGS { /// A text color. VPCF_TEXT = 1, /// A background color. VPCF_BACKGROUND, /// A sort-column color. VPCF_SORTCOLUMN, /// A subtext color. VPCF_SUBTEXT, /// Windows 7 and later. A text background color. VPCF_TEXTBACKGROUND, } /// Specifies watermark flags. Used by IVisualProperties::SetWatermark. // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/ne-shobjidl-vpwatermarkflags typedef enum VPWATERMARKFLAGS { // VPWF_DEFAULT, VPWF_ALPHABLEND } ; [PInvokeData("shobjidl.h", MSDNShortId = "NE:shobjidl.VPWATERMARKFLAGS")] [Flags] public enum VPWATERMARKFLAGS { /// Default Windows XP behavior. VPWF_DEFAULT = 0, /// Alpha blend the respective bitmap; assumed 24-bit color + 8-bit alpha. VPWF_ALPHABLEND = 1, } /// Exposes methods that set and get visual properties. // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nn-shobjidl-ivisualproperties [PInvokeData("shobjidl.h", MSDNShortId = "NN:shobjidl.IVisualProperties")] [ComImport, Guid("e693cf68-d967-4112-8763-99172aee5e5a"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IVisualProperties { /// Provides a bitmap to use as a watermark. /// /// Type: HBITMAP /// A handle to the bitmap. /// /// /// Type: VPWATERMARKFLAGS /// VPWATERMARKFLAGS flags that customize the watermark. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ivisualproperties-setwatermark HRESULT SetWatermark( // HBITMAP hbmp, VPWATERMARKFLAGS vpwf ); void SetWatermark(HBITMAP hbmp, VPWATERMARKFLAGS vpwf); /// Sets the color, as specified. /// /// Type: VPCOLORFLAGS /// The color flags. See VPCOLORFLAGS. /// /// /// Type: COLORREF /// A value of type COLORREF /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ivisualproperties-setcolor HRESULT SetColor( // VPCOLORFLAGS vpcf, COLORREF cr ); void SetColor(VPCOLORFLAGS vpcf, COLORREF cr); /// Gets the color, as specified. /// /// Type: VPCOLORFLAGS /// The color flags. See VPCOLORFLAGS /// /// /// Type: COLORREF* /// A pointer to a value of type COLORREF. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ivisualproperties-getcolor HRESULT GetColor( // VPCOLORFLAGS vpcf, COLORREF *pcr ); COLORREF GetColor(VPCOLORFLAGS vpcf); /// Sets the specified item height. /// /// Type: int /// The item height, in pixels. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ivisualproperties-setitemheight HRESULT // SetItemHeight( int cyItemInPixels ); void SetItemHeight(int cyItemInPixels); /// Gets the item height. /// /// Type: int* /// A pointer to the item height, in pixels. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ivisualproperties-getitemheight HRESULT // GetItemHeight( int *cyItemInPixels ); int GetItemHeight(); /// Sets attributes of the font. /// /// Type: const LOGFONTW* /// A pointer to a LOGFONT structure that contains the attributes to set. /// /// /// Type: BOOL /// TRUE if the item should be redrawn after the new attributes are set; otherwise FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ivisualproperties-setfont HRESULT SetFont( const // LOGFONTW *plf, BOOL bRedraw ); void SetFont(in LOGFONT plf, [MarshalAs(UnmanagedType.Bool)] bool bRedraw); /// Gets the current attributes set on the font. /// /// Type: LOGFONTW* /// /// A pointer to a LOGFONT structure that, when this method returns successfully, receives the current attributes of the font. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ivisualproperties-getfont HRESULT GetFont( LOGFONTW // *plf ); LOGFONT GetFont(); /// Sets the specified theme. /// /// Type: LPCWSTR /// /// A pointer to a Unicode 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 /// /// A pointer to a Unicode string that contains a semicolon-separated list of CLSID names for 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. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-ivisualproperties-settheme HRESULT SetTheme( LPCWSTR // pszSubAppName, LPCWSTR pszSubIdList ); void SetTheme([MarshalAs(UnmanagedType.LPWStr)] string pszSubAppName, [MarshalAs(UnmanagedType.LPWStr)] string pszSubIdList); } } }