📄 visualstylesxp.h
字号:
#ifndef _VISUALSTYLE_XP_H_
#define _VISUALSTYLE_XP_H_
#pragma once
#include <uxtheme.h>
#include <tmschema.h>
class CVisualStylesXP
{
public:
CVisualStylesXP(void);
~CVisualStylesXP(void);
HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList);
HRESULT CloseThemeData(HTHEME hTheme);
HRESULT DrawThemeBackground(HTHEME hTheme, HDC hdc,
int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect);
HRESULT DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,
DWORD dwTextFlags2, const RECT *pRect);
HRESULT GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc,
int iPartId, int iStateId, const RECT *pBoundingRect,
RECT *pContentRect);
HRESULT GetThemeBackgroundExtent(HTHEME hTheme, HDC hdc,
int iPartId, int iStateId, const RECT *pContentRect,
RECT *pExtentRect);
HRESULT GetThemePartSize(HTHEME hTheme, HDC hdc,
int iPartId, int iStateId, RECT * pRect, enum THEMESIZE eSize, SIZE *psz);
HRESULT GetThemeTextExtent(HTHEME hTheme, HDC hdc,
int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,
DWORD dwTextFlags, const RECT *pBoundingRect,
RECT *pExtentRect);
HRESULT GetThemeTextMetrics(HTHEME hTheme, HDC hdc,
int iPartId, int iStateId, TEXTMETRIC* ptm);
HRESULT GetThemeBackgroundRegion(HTHEME hTheme, HDC hdc,
int iPartId, int iStateId, const RECT *pRect, HRGN *pRegion);
HRESULT HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, DWORD dwOptions, const RECT *pRect, HRGN hrgn,
POINT ptTest, WORD *pwHitTestCode);
HRESULT DrawThemeEdge(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
const RECT *pDestRect, UINT uEdge, UINT uFlags, RECT *pContentRect);
HRESULT DrawThemeIcon(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex);
BOOL IsThemePartDefined(HTHEME hTheme, int iPartId,
int iStateId);
BOOL IsThemeBackgroundPartiallyTransparent(HTHEME hTheme,
int iPartId, int iStateId);
HRESULT GetThemeColor(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, COLORREF *pColor);
HRESULT GetThemeMetric(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, int iPropId, int *piVal);
HRESULT GetThemeString(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, LPWSTR pszBuff, int cchMaxBuffChars);
HRESULT GetThemeBool(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, BOOL *pfVal);
HRESULT GetThemeInt(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, int *piVal);
HRESULT GetThemeEnumValue(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, int *piVal);
HRESULT GetThemePosition(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, POINT *pPoint);
HRESULT GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, int iPropId, LOGFONT *pFont);
HRESULT GetThemeRect(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, RECT *pRect);
HRESULT GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId,
int iStateId, int iPropId, RECT *prc, MARGINS *pMargins);
HRESULT GetThemeIntList(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, INTLIST *pIntList);
HRESULT GetThemePropertyOrigin(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, enum PROPERTYORIGIN *pOrigin);
HRESULT SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName,
LPCWSTR pszSubIdList);
HRESULT GetThemeFilename(HTHEME hTheme, int iPartId,
int iStateId, int iPropId, LPWSTR pszThemeFileName, int cchMaxBuffChars);
COLORREF GetThemeSysColor(HTHEME hTheme, int iColorId);
HBRUSH GetThemeSysColorBrush(HTHEME hTheme, int iColorId);
BOOL GetThemeSysBool(HTHEME hTheme, int iBoolId);
int GetThemeSysSize(HTHEME hTheme, int iSizeId);
HRESULT GetThemeSysFont(HTHEME hTheme, int iFontId, LOGFONT *plf);
HRESULT GetThemeSysString(HTHEME hTheme, int iStringId,
LPWSTR pszStringBuff, int cchMaxStringChars);
HRESULT GetThemeSysInt(HTHEME hTheme, int iIntId, int *piValue);
BOOL IsThemeActive();
BOOL IsAppThemed();
HTHEME GetWindowTheme(HWND hwnd);
HRESULT EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags);
BOOL IsThemeDialogTextureEnabled(HWND hwnd);
DWORD GetThemeAppProperties();
void SetThemeAppProperties(DWORD dwFlags);
HRESULT GetCurrentThemeName(
LPWSTR pszThemeFileName, int cchMaxNameChars,
LPWSTR pszColorBuff, int cchMaxColorChars,
LPWSTR pszSizeBuff, int cchMaxSizeChars);
HRESULT GetThemeDocumentationProperty(LPCWSTR pszThemeName,
LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars);
HRESULT DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT* prc);
HRESULT EnableTheming(BOOL fEnable);
private:
static HMODULE m_hThemeDll;
static void* GetProc(LPCSTR szProc, void* pfnFail);
typedef HTHEME (__stdcall *PFNOPENTHEMEDATA)(HWND hwnd, LPCWSTR pszClassList);
static HTHEME OpenThemeDataFail(HWND, LPCWSTR) {return NULL;}
typedef HRESULT(__stdcall *PFNCLOSETHEMEDATA)(HTHEME hTheme);
static HRESULT CloseThemeDataFail(HTHEME) {return E_FAIL;}
typedef HRESULT(__stdcall *PFNDRAWTHEMEBACKGROUND)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect);
static HRESULT DrawThemeBackgroundFail(HTHEME, HDC, int, int, const RECT *, const RECT *) {return E_FAIL;}
typedef HRESULT (__stdcall *PFNDRAWTHEMETEXT)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect);
static HRESULT DrawThemeTextFail(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT*) {return E_FAIL;}
typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect);
static HRESULT GetThemeBackgroundContentRectFail(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect) {return E_FAIL;}
typedef HRESULT (__stdcall *PFNGETTHEMEBACKGROUNDEXTENT)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pContentRect, RECT *pExtentRect);
static HRESULT GetThemeBackgroundExtentFail(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pContentRect, RECT *pExtentRect) {return E_FAIL;}
typedef HRESULT(__stdcall *PFNGETTHEMEPARTSIZE)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT * pRect, enum THEMESIZE eSize, SIZE *psz);
static HRESULT GetThemePartSizeFail(HTHEME, HDC, int, int, RECT *, enum THEMESIZE, SIZE *) {return E_FAIL;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -