25_2901_9改变窗口标题栏背景颜色.c
来自「嵌入式图形界面MiniGUI的示例程序9例」· C语言 代码 · 共 86 行
C
86 行
#include <stdio.h>#include <stdlib.h>#include <minigui/common.h>#include <minigui/minigui.h>#include <minigui/gdi.h>#include <minigui/window.h>#include <minigui/control.h>HWND hwnd;static DLGTEMPLATE DlgYourTaste ={ WS_BORDER | WS_CAPTION, WS_EX_NONE, 0, 0, 370, 280, "Creat MainWindow with Dialog", 0, 0, 2, NULL, 0};static CTRLDATA CtrlYourTaste[] ={ { "button", WS_VISIBLE | BS_DEFPUSHBUTTON | WS_TABSTOP | WS_GROUP, 70, 220, 70, 28, IDOK, "OK", 0 }, { "button", WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP, 200, 220, 70, 28, IDCANCEL, "Cancel", 0 },};static int DialogBoxProc2 (HWND hDlg, int message, WPARAM wParam, LPARAM lParam){ switch(message){ case MSG_COMMAND: switch (wParam) { case IDOK: SetWindowElementColorEx(hDlg,2,3333);//3333为改变的颜色值 UpdateWindow(hDlg,TRUE); break; case IDCANCEL: DestroyMainWindowIndirect (hDlg); break; } break; } return DefaultDialogProc (hDlg, message, wParam, lParam);}int MiniGUIMain (int argc, const char* argv[]){ MSG Msg;#ifdef _LITE_VERSION SetDesktopRect(0, 0, 1024, 768);#endif DlgYourTaste.controls = CtrlYourTaste; hwnd = CreateMainWindowIndirect (&DlgYourTaste, HWND_DESKTOP, DialogBoxProc2); if (hwnd == HWND_INVALID){ return -1;} while (GetMessage (&Msg, hwnd)) { TranslateMessage (&Msg); DispatchMessage (&Msg); } DestroyMainWindowIndirect (hwnd); return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?