【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.3.1.16 GETN_COLOR
Contents
Name
GETN_COLOR
Declaration
#define GETN_COLOR(_NODE_NAME, _NODE_LABEL, _DEFAULT_VAL) _tmpSubNode = _tmpNode.AddNumericNode(_DEFAULT_VAL, #_NODE_NAME, TRGP_COLOR);TREE_ADD_LABEL(_NODE_LABEL);
Remark
This macro creates a color combo list(system palette) in the dialogbox.
Use numeric offset to set the default color by index.
Parameters
- _NODE_NAME
- [input] the name of the new node to be added to the tree
- _NODE_LABEL
- [input] the string value to show as the node name in the dialogbox
- _DEFAULT_VAL
- [input] index of the color
Return
Examples
EX1
#include <GetNbox.h> void GETN_COLOR_ex1() { GETN_TREE(tr); GETN_STR(info, " ", "Please pick a color") GETN_READ_ONLY GETN_COLOR(LineColor, "Fit Curve color", 3) if( GetNBox( tr )) { char szTemp[100]; int nIndex = tr.LineColor.nVal; color_index_to_name(nIndex, szTemp, 100); UINT cr = color_index_to_rgb(nIndex); printf("choosen color %s\n", szTemp); printf("Red = %d, Green = %d, Blue = %d\n", GetRValue(cr), GetGValue(cr), GetBValue(cr)); } }
EX2
void GETN_COLOR_CHOICE_OPTIONS_ex2() { GETN_TREE(tr) GETN_STR(info, " ", "Please pick a color") GETN_READ_ONLY GETN_COLOR(LineColor, "Fit Curve color", 3) GETN_COLOR(clr, "Color", 0) GETN_COLOR_CHOICE_OPTIONS(COLORLIST_CUSTOM ) vector<int> vnClrs = {1, 14, 6, 16842624, 2, 4, 33521664, 3}; GETN_COLORLIST(ColorList,"color list",vnClrs) if( GetNBox( tr )) { char szTemp[100]; int nIndex = tr.LineColor.nVal; color_index_to_name(nIndex, szTemp, 100); UINT cr = color_index_to_rgb(nIndex); printf("choosen color %s\n", szTemp); printf("Red = %d, Green = %d, Blue = %d\n", GetRValue(cr), GetGValue(cr), GetBValue(cr)); } }
See Also
Header to Include
GetNbox.h