📄 timeset.c
字号:
SetWindowAdditionalData(hwnd, (DWORD)&ok_mousemove);
}
if(hwnd == hCtrl2 && nc == MYBUTTON_MOUSEMOVE)
{
SetWindowAdditionalData(hwnd, (DWORD)&return_mousemove);
}
if( hwnd == hCtrl3 && nc == MYBUTTON_MOUSEMOVE)
{
SetWindowAdditionalData(hwnd, (DWORD)&green_mousemove);
}
if(hwnd == hCtrl4 && nc == MYBUTTON_MOUSEMOVE)
{
SetWindowAdditionalData(hwnd, (DWORD)&blue_mousemove);
}
InvalidateRect (hwnd, NULL, TRUE);
}
*/
static int SetTimeProc(HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
int i;
//static HWND hChildWnd1,hWnd1,hWnd2,hWnd3;
char temp[20];
switch (message) {
case MSG_INITDIALOG:
ShowRightTime(hDlg);
/* LoadBitmap (HDC_SCREEN, &ok_pushed, "image/button/113.jpg");
LoadBitmap (HDC_SCREEN, &ok_unpushed, "image/button/111.jpg");
LoadBitmap (HDC_SCREEN, &ok_mousemove, "image/button/112.jpg");
LoadBitmap (HDC_SCREEN, &return_pushed, "image/button/223.jpg");
LoadBitmap (HDC_SCREEN, &return_unpushed, "image/button/221.jpg");
LoadBitmap (HDC_SCREEN, &return_mousemove, "image/button/222.jpg");
LoadBitmap (HDC_SCREEN, &green_pushed, "image/button/123.jpg");
LoadBitmap (HDC_SCREEN, &green_unpushed, "image/button/121.jpg");
LoadBitmap (HDC_SCREEN, &green_mousemove, "image/button/122.jpg");
LoadBitmap (HDC_SCREEN, &blue_pushed, "image/button/133.jpg");
LoadBitmap (HDC_SCREEN, &blue_unpushed, "image/button/131.jpg");
LoadBitmap (HDC_SCREEN, &blue_mousemove, "image/button/132.jpg");
self defined button
hCtrl1 = CreateWindowEx (CTRL_MYBUTTON, "button",
WS_CHILD | WS_VISIBLE ,//| WS_BORDER,
WS_EX_TRANSPARENT,
IDC_OK,
260, 20,
ok_pushed.bmWidth, ok_pushed.bmHeight,
hDlg,
(DWORD)&ok_unpushed
);*/
hCtrl1 =CreateWindow ("button",
"确定",
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
IDC_OK,
260, 20,50,30, hDlg, 0);
/*hCtrl2 = CreateWindowEx (CTRL_MYBUTTON, "button",
WS_CHILD | WS_VISIBLE ,//| WS_BORDER,
WS_EX_TRANSPARENT,
IDC_CL,
260, 105,
return_pushed.bmWidth, return_pushed.bmHeight,
hDlg,
(DWORD)&return_unpushed
);*/
hCtrl2 =CreateWindow ("button",
"变蓝",
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
IDC_CS ,
260, 62,50,30 , hDlg, 0);
/*hCtrl3 = CreateWindowEx (CTRL_MYBUTTON, "button",
WS_CHILD | WS_VISIBLE ,//| WS_BORDER,
WS_EX_TRANSPARENT,
IDC_BS,
259, 62,
green_pushed.bmWidth, green_pushed.bmHeight,
hDlg,
(DWORD)&green_unpushed
);*/
hCtrl3 =CreateWindow ("button",
"变绿",
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
IDC_BS,
260, 100,50,30 ,hDlg, 0);
/*hCtrl4 = CreateWindowEx (CTRL_MYBUTTON, "button",
WS_CHILD | WS_VISIBLE ,//| WS_BORDER,
WS_EX_TRANSPARENT,
IDC_CS,
284, 62,
blue_pushed.bmWidth, blue_pushed.bmHeight,
hDlg,
(DWORD)&blue_unpushed
);*/
hCtrl4 =CreateWindow ("button",
"取消",
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
IDC_CL,
260, 150,50,30 ,hDlg, 0);
/*SetNotificationCallback (hCtrl1, notify_proc);
SetNotificationCallback (hCtrl2, notify_proc);
SetNotificationCallback (hCtrl3, notify_proc);
SetNotificationCallback (hCtrl4, notify_proc);
*/
hChildWnd1 = CreateWindow ("monthcalendar",
"monthcalendar",
WS_CHILD |
WS_VISIBLE |
MCS_ENG_L |
MCS_NOTIFY,
IDC_MC,
10, 10, 240, 130, hDlg, 0);
hWnd1 = CreateWindowEx (CTRL_COMBOBOX, "",
#if _MINIGUI_VERSION_CODE >= _VERSION_CODE (1, 5, 3)
WS_VISIBLE | CBS_SPINLIST | CBS_SPINARROW_TOPBOTTOM | CBS_EDITNOBORDER | WS_TABSTOP | CBS_SORT,
#else
WS_VISIBLE | CBS_SPINLIST | CBS_EDITNOBORDER | WS_TABSTOP | CBS_SORT,
#endif
WS_EX_NONE,IDC_HOURE,50,150,40,35, hDlg, 0);
hWnd2 = CreateWindowEx (CTRL_COMBOBOX,"",
#if _MINIGUI_VERSION_CODE >= _VERSION_CODE (1, 5, 3)
WS_VISIBLE | CBS_SPINLIST | CBS_SPINARROW_TOPBOTTOM | CBS_EDITNOBORDER | WS_TABSTOP | CBS_SORT,
#else
WS_VISIBLE | CBS_SPINLIST | CBS_EDITNOBORDER | WS_TABSTOP | CBS_SORT,
#endif
WS_EX_NONE, IDC_MINUTEE,110, 150,40,35, hDlg, 0);
hWnd3 = CreateWindowEx (CTRL_COMBOBOX,"",
#if _MINIGUI_VERSION_CODE >= _VERSION_CODE (1, 5, 3)
WS_VISIBLE | CBS_SPINLIST | CBS_SPINARROW_TOPBOTTOM | CBS_EDITNOBORDER | WS_TABSTOP | CBS_SORT,
#else
WS_VISIBLE | CBS_SPINLIST | CBS_EDITNOBORDER | WS_TABSTOP | CBS_SORT,
#endif
WS_EX_NONE,IDC_SECONDE,170,150,40,35, hDlg, 0);
for (i = j; i < 24; i++)
{
sprintf (temp, "%2d", i);
SendMessage (hWnd1, CB_ADDSTRING, 0, (LPARAM)temp);
}
for (i = k; i < 60; i++) {
sprintf (temp, "%2d", i);
SendMessage (hWnd2, CB_ADDSTRING, 0, (LPARAM)temp);
}
for (i = l; i < 60; i++) {
sprintf (temp, "%2d", i);
SendMessage (hWnd3, CB_ADDSTRING, 0, (LPARAM)temp);
}
ShowRightTime(hDlg);
break;
case MSG_MOUSEMOVE:
/*SetWindowAdditionalData(hCtrl1, (DWORD)&ok_unpushed);
SetWindowAdditionalData(hCtrl2, (DWORD)&return_unpushed);
SetWindowAdditionalData(hCtrl3, (DWORD)&green_unpushed);
SetWindowAdditionalData(hCtrl4, (DWORD)&blue_unpushed);
*/
InvalidateRect (hCtrl1, NULL, TRUE);
InvalidateRect (hCtrl2, NULL, TRUE);
InvalidateRect (hCtrl3, NULL, TRUE);
InvalidateRect (hCtrl4, NULL, TRUE);
break;
case MSG_COMMAND:
{
if ((int)wParam == IDC_OK)
{
SetRightTime(hDlg);
}
if ((int)wParam == IDC_CL)
{
EndDialog (hDlg, 0);
}
if ((int)wParam == IDC_BS)
{
MCCOLORINFO mcci;
memset (&mcci, -1, 11*sizeof(int));
mcci.clr_titlebk = COLOR_lightgray;
mcci.clr_titletext = PIXEL_lightwhite;
mcci.clr_arrow = PIXEL_blue;
mcci.clr_arrowHibk = COLOR_yellow;
mcci.clr_daybk = COLOR_green;
mcci.clr_dayHibk = COLOR_magenta;
mcci.clr_daytext = PIXEL_lightwhite;
mcci.clr_trailingtext = COLOR_darkgreen;
mcci.clr_dayHitext = COLOR_lightwhite;
mcci.clr_weekcaptbk = COLOR_yellow;
mcci.clr_weekcapttext = COLOR_magenta;
SendMessage (hChildWnd1, MCM_SETCOLOR, 0, (LPARAM) &mcci);
}
if ((int)wParam == IDC_CS)
{
MCCOLORINFO mcci;
memset (&mcci, -1, 11*sizeof(int));
mcci.clr_titlebk = COLOR_lightgray;
mcci.clr_titletext = PIXEL_lightwhite;
mcci.clr_arrow = PIXEL_blue;
mcci.clr_arrowHibk = COLOR_yellow;
mcci.clr_daybk = COLOR_blue;
mcci.clr_dayHibk = COLOR_magenta;
mcci.clr_daytext = PIXEL_lightwhite;
mcci.clr_trailingtext = COLOR_darkgreen;
mcci.clr_dayHitext = COLOR_lightwhite;
mcci.clr_weekcaptbk = COLOR_yellow;
mcci.clr_weekcapttext = COLOR_magenta;
SendMessage (hChildWnd1, MCM_SETCOLOR, 0, (LPARAM) &mcci);
}
}
break;
case MSG_ERASEBKGND:
{
HDC hdc = (HDC)wParam;
const RECT* clip = (const RECT*) lParam;
BOOL fGetDC = FALSE;
RECT rcTemp;
if (hdc == 0) {
hdc = GetClientDC (hDlg);
fGetDC = TRUE;
}
if (clip) {
rcTemp = *clip;
ScreenToClient (hDlg, &rcTemp.left, &rcTemp.top);
ScreenToClient (hDlg, &rcTemp.right, &rcTemp.bottom);
IncludeClipRect (hdc, &rcTemp);
}
FillBoxWithBitmap (hdc, 0, 0, 320, 206, &bmp_bkgnd);
if (fGetDC)
ReleaseDC (hdc);
return 0;
}
case MSG_CLOSE:
/*UnloadBitmap (&bmp_bkgnd);
UnloadBitmap (&return_pushed);
UnloadBitmap (&return_unpushed);
UnloadBitmap (&return_mousemove);
UnloadBitmap (&ok_pushed);
UnloadBitmap (&ok_unpushed);
UnloadBitmap (&ok_mousemove);
UnloadBitmap (&green_pushed);
UnloadBitmap (&green_unpushed);
UnloadBitmap (&green_mousemove);
UnloadBitmap (&blue_pushed);
UnloadBitmap (&blue_unpushed);
UnloadBitmap (&blue_mousemove);*/
EndDialog (hDlg, 0);
return 0;
}
return DefaultDialogProc (hDlg, message, wParam, lParam);
}
int settime (HWND hWnd)
{
if (!InitMiniGUIExt()) {
return 2;
}
if (LoadBitmap (HDC_SCREEN, &bmp_bkgnd, "image/background/bkgnd29.jpg"))
return -1;
RegisterMyButtonControl ();
DlgTime1.controls = CtrlTime1;
//创建日历对话框
DialogBoxIndirectParam (&DlgTime1, hWnd, SetTimeProc, 0L);
UnregisterMyButtonControl ();
MiniGUIExtCleanUp ();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -