调用 winapi 弹出颜色选择对话框
[編輯] [转简体] (简体译文)
|
作者:huidong
| 分類:【編程】Win32
[
7 瀏覽
0 評論
1 贊
1 踩
]
概要
调用 winapi 弹出颜色选择对话框
正文
COLORREF getcolor() { CHOOSECOLOR cc; // common dialog box structure static COLORREF acrCustClr[16]; // array of custom colors static DWORD rgbCurrent; // initial color selection int getcolor; // Initialize CHOOSECOLOR ZeroMemory(&cc, sizeof(cc)); cc.lStructSize = sizeof(cc); cc.hwndOwner = GetHWnd(); cc.lpCustColors = (LPDWORD)acrCustClr; cc.rgbResult = rgbCurrent; cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_ANYCOLOR | CC_SOLIDCOLOR; if (ChooseColor(&cc) == TRUE) { return cc.rgbResult; } else { return -1; } }
函数返回值:用户所选取的颜色