I want be able to select any color I want, just like the attached pic.
Yes I want to learn this C++ or MFC. I find it more powerful. Could you explain to me exactly how to add it to my project? I also want the color itself and it code appears in picture box and textbox.
Use CColorDialog
class in mfc is used to pick the color from MFC
// Get the selected color from the CColorDialog.
CColorDialog dlg;
if (dlg.DoModal() == IDOK)
{
COLORREF color = dlg.GetColor();
}
This sample will popup dialog to select the color and after selecting the color and click ok button then color variable will contain the selected color.
Use this color in your application.
EDIT
You can customize your combo box or list box to add the color pick tool.
Refer this link : CodeProjectSample
CMFCColorDialog
or CColorDialog
is what you seem to be looking for. To make it act like a drop-down, you'll need to position it below the down-arrow button (e.g., using MoveWindow
).
CColorDialog
creates the "old standard" color picker dialog, like this:
CMFCColorDialog
creates the somewhat newer color picker, like this one:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With