rgb(192, 192, 192), // light grey
rgb(128, 128, 128), // dark grey
rgb(255, 0, 0), // red
rgb(0, 255, 0), // green
rgb(255, 255, 0), // yellow
rgb(0, 0, 255), // blue
rgb(255, 0, 255), // magenta
rgb(0, 255, 255), // cyan
};
ccombocolorpicker::ccombocolorpicker()
{
m_binitialized = false;
}
ccombocolorpicker::~ccombocolorpicker()
{
}
begin_message_map(ccombocolorpicker, ccombobox)
//{{afx_msg_map(ccombocolorpicker)
on_wm_create()
//}}afx_msg_map
end_message_map()
/////////////////////////////////////////////////////////////////////////////
// ccombocolorpicker message handlers
int ccombocolorpicker::oncreate(lpcreatestruct lpcreatestruct)
{
if (ccombobox::oncreate(lpcreatestruct) == -1)
return -1;
initializedata();
return 0;
}
void ccombocolorpicker::presubclasswindow()
{
initializedata();
ccombobox::presubclasswindow();
}
void ccombocolorpicker::initializedata()
{
int nitem;
if (m_binitialized)
return;
for (int ncolor = 0; ncolor hdc))
return;
colorref rgbtextcolor = dc.gettextcolor();
colorref rgbbkcolor = dc.getbkcolor();
if (lpdrawitemstruct->itemaction & oda_focus)
{
dc.drawfocusrect(&lpdrawitemstruct->rcitem);
}
else if (lpdrawitemstruct->itemaction & oda_drawentire)
{
if (lpdrawitemstruct->itemstate & ods_focus)
dc.drawfocusrect(&lpdrawitemstruct->rcitem);
else
dc.exttextout(0, 0, eto_opaque, &lpdrawitemstruct->rcitem, _t(""), 0, null);
}
if (0 <= (int)lpdrawitemstruct->itemid) // any item selected?
{
::inflaterect(&lpdrawitemstruct->rcitem, -2, -2);
dc.fillsolidrect(&lpdrawitemstruct->rcitem, (colorref)lpdrawitemstruct->itemdata);
dc.framerect(&lpdrawitemstruct->rcitem, &brushblack);
}
// restore the dc state
dc.settextcolor(rgbtextcolor);