标签:img 运行 href article null inline 包括 oar clu
参考网站:http://blog.csdn.net/u013242177/article/details/50437358
static CHOOSECOLOR stChooseColor; static COLORREF rgbLineColor;
其中CHOOSECOLOR是一个结构体,包括了用ChooseColor函数来初始化颜色对话框的一些信息,可以从MSDN中查到这个结构体如下:
typedef struct {
DWORD lStructSize;
HWND hwndOwner;
HWND hInstance;
COLORREF rgbResult;
COLORREF* lpCustColors;
DWORD Flags;
LPARAM lCustData;
LPCCHOOKPROC lpfnHook;
LPCTSTR lpTemplateName;
} CHOOSECOLOR;
stChooseColor.lStructSize = sizeof(CHOOSECOLOR) ; stChooseColor.hwndOwner = hWnd ; stChooseColor.rgbResult = rgbLineColor ; stChooseColor.lpCustColors = (LPDWORD) dwCustColors ; stChooseColor.Flags = CC_RGBINIT ; stChooseColor.lCustData = 0 ; stChooseColor.lpfnHook = NULL ; stChooseColor.lpTemplateName = NULL ;
if (ChooseColor(&stChooseColor)) { rgbLineColor = stChooseColor.rgbResult; }
获取COLORREF中RGB分量值:
COLORREF colorrrefRGB =RGB(120,250,110); BYTE r = GetRValue(colorrrefRGB); BYTE g = GetGValue(colorrrefRGB); BYTE b = GetBValue(colorrrefRGB);
#include "commdlg.h" ...................................... void CmyDialogt::OnBnClickedButtonPickcolor() { // TODO: Add your control notification handler code here static CHOOSECOLOR stChooseColor; static COLORREF rgbLineColor; static COLORREF dwCustColors[16]; stChooseColor.lStructSize = sizeof(CHOOSECOLOR) ; stChooseColor.hwndOwner = this->m_hWnd ; stChooseColor.rgbResult = rgbLineColor ; stChooseColor.lpCustColors = (LPDWORD) dwCustColors ; stChooseColor.Flags = CC_RGBINIT ; stChooseColor.lCustData = 0 ; stChooseColor.lpfnHook = NULL ; stChooseColor.lpTemplateName = NULL ; if (ChooseColor(&stChooseColor)) { rgbLineColor = stChooseColor.rgbResult; BYTE r = GetRValue(rgbLineColor); BYTE g = GetGValue(rgbLineColor); BYTE b = GetBValue(rgbLineColor); } }
运行结果:
标签:img 运行 href article null inline 包括 oar clu
原文地址:http://www.cnblogs.com/betterwgo/p/6909903.html