📄 dialog_slidercolor.c
字号:
0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x00, 0x00, 0x00, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x00, 0x00};static const GUI_BITMAP bmSeggerLogoBlue = { 138, /* XSize */ 65, /* YSize */ 69, /* BytesPerLine */ 4, /* BitsPerPixel */ acSeggerLogoBlue16, /* Pointer to picture data (indices) */ &PalSeggerLogoBlue16 /* Pointer to palette */};/*********************************************************************** static data, dialog resource************************************************************************//*********************************************************************** Dialog resource** This table conatins the info required to create the dialog.* It has been created manually, but could also be created by a GUI-builder.*/static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = { { FRAMEWIN_CreateIndirect, "Adjust color", 0, 10, 40, 300, 160, FRAMEWIN_CF_MOVEABLE}, { TEXT_CreateIndirect, "Red:" , 0, 5, 20, 35, 20, TEXT_CF_LEFT }, { TEXT_CreateIndirect, "Green:", 0, 5, 50, 35, 20, TEXT_CF_LEFT }, { TEXT_CreateIndirect, "Blue:", 0, 5, 80, 35, 20, TEXT_CF_LEFT }, { TEXT_CreateIndirect, "Preview",0, 205, 4, 81, 15, TEXT_CF_HCENTER }, { SLIDER_CreateIndirect, NULL, GUI_ID_SLIDER0, 40, 20, 100, 20 }, { SLIDER_CreateIndirect, NULL, GUI_ID_SLIDER1, 40, 50, 100, 20 }, { SLIDER_CreateIndirect, NULL, GUI_ID_SLIDER2, 40, 80, 100, 20 }, { EDIT_CreateIndirect, NULL, GUI_ID_EDIT0, 145, 20, 30, 20, 0, 3 }, { EDIT_CreateIndirect, NULL, GUI_ID_EDIT1, 145, 50, 30, 20, 0, 3 }, { EDIT_CreateIndirect, NULL, GUI_ID_EDIT2, 145, 80, 30, 20, 0, 3 }, { BUTTON_CreateIndirect, "OK", GUI_ID_OK, 10, 110, 60, 20 }, { BUTTON_CreateIndirect, "Cancel", GUI_ID_CANCEL, 230, 110, 60, 20 },};/*********************************************************************** static data, colors************************************************************************/static U8 _aColorSep[3] = {0, 127, 255}; /* Red, green and blue components *//*********************************************************************** static code************************************************************************//*********************************************************************** _OnPaint This routine draws the color rectangles. The widgets are drawn automatically.*/static void _OnPaint(void) { /* Draw RGB values */ GUI_SetColor(_aColorSep[0]); GUI_FillRect(180, 20, 199, 39); GUI_SetColor(_aColorSep[1] << 8); GUI_FillRect(180, 50, 199, 69); GUI_SetColor(((U32)_aColorSep[2]) << 16); GUI_FillRect(180, 80, 199, 99); /* Draw resulting color */ GUI_SetColor(_aColorSep[0] | (((U32)_aColorSep[1]) << 8) | (((U32)_aColorSep[2]) << 16)); GUI_FillRect(205, 20, 285, 99);}/*********************************************************************** _OnValueChanged*/static void _OnValueChanged(WM_HWIN hDlg, int Id) { unsigned Index, v; WM_HWIN hSlider, hEdit; if ((Id >= GUI_ID_SLIDER0) && (Id <= GUI_ID_SLIDER2)) { Index = Id - GUI_ID_SLIDER0; /* SLIDER-widget has changed, update EDIT-widget */ hSlider = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0 + Index); hEdit = WM_GetDialogItem(hDlg, GUI_ID_EDIT0 + Index); v = SLIDER_GetValue(hSlider); EDIT_SetValue(hEdit, v); } else if ((Id >= GUI_ID_EDIT0) && (Id <= GUI_ID_EDIT2)) { Index = Id - GUI_ID_EDIT0; /* If EDIT-widget has changed, update SLIDER-widget */ hSlider = WM_GetDialogItem(hDlg, GUI_ID_SLIDER0 + Index); hEdit = WM_GetDialogItem(hDlg, GUI_ID_EDIT0 + Index); v = EDIT_GetValue(hEdit); SLIDER_SetValue(hSlider, v); } _aColorSep[Index] = v;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -