Color dialog box palette

Source: Internet
Author: User

 

The system palette dialog box can be divided into three parts: basic colors, custom colors, and extended.

 

In the create a palette dialog box, you only need to define a choosecolor variable, configure the members of this struct, and then call the choosecolor function with this variable as the parameter.

Choosecolor struct:

Typedef struct {<br/> DWORD lstructsize; <br/> hwnd hwndowner; <br/> hwnd hinstance; <br/> colorref rgbresult; <br/> colorref * lpcustcolors; <br/> DWORD flags; <br/> lparam lcustdata; <br/> lpcchookproc lpfnhook; <br/> lpctstr lptemplatename; <br/>} choosecolor, * lpchoosecolor;

The size of the lstructsize struct, usually initialized to sizeof (choosecolor ).

The handle of the window in the hwndowner create palette dialog box, which can be null.

A member of the result returned by rgbresult.

Lpcustcolors color buffer. The size is 16 colorref and the initial value of custom colors.

Flages is the most complex member. All attributes and features are determined by this member and can have a series of values or.

 

/*

Hinstance, lcustdata, lpfnhook, and lptemplatename can ignore these four parameters if you do not use a complex template.

*/

 

If the cc_rgbinit bit is set for flages, the initial value of rgbresult in the dialog box is the color. If the value of rgbresult is not in basic colors, the first one is selected by default.

If cc_fullopen is set for flages, the three regions are displayed. If cc_preventfullopen is set, the extended region is not displayed, and the define custom colors button is invalid.

This is the three long labels.

 

 

After the struct is configured, call the choosecolor function to bring up the palette dialog box. If you click OK, the function returns true and the selected result is stored in rgbresult; if the add to m colors button is used before clicking OK, the value in the lpcustcolors buffer will change.

 

If you want to maintain the last configuration of 16 colors in the Custom colors during the second pop-up dialog, you only need to properly keep the lpcustcolors buffer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.