⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 button.c

📁 MiniGUI到ucOS-II的位图操作。通过该例子
💻 C
字号:
/* ** $Id: button.c,v 1.8 2003/11/23 13:09:22 weiym Exp $**** Listing 7.1**** button.c: Sample program for MiniGUI Programming Guide**     Usage of BUTTON control.**** Copyright (C) 2003 Feynman Software.**** License: GPL*/#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>#define IDC_LAMIAN              101#define IDC_CHOUDOUFU           102#define IDC_JIANBING            103#define IDC_MAHUA               104#define IDC_SHUIJIAO            105#define IDC_XIAN                110#define IDC_LA                  111#define IDC_PROMPT              200static DLGTEMPLATE DlgYourTaste ={    WS_BORDER | WS_CAPTION,    WS_EX_NONE,    0, 0, 240, 280,    "您喜欢吃哪种风味的小吃",    0, 0,    12, NULL,    0};static CTRLDATA CtrlYourTaste[] ={     {        "static",        WS_VISIBLE | SS_GROUPBOX,         16, 10, 130, 160,        IDC_STATIC,        "可选小吃",        0    },    {        "button",        WS_VISIBLE | BS_AUTORADIOBUTTON | BS_CHECKED | WS_TABSTOP | WS_GROUP,        36, 38, 88, 20,        IDC_LAMIAN,        "西北拉面",        0    },    {        "button",        WS_VISIBLE | BS_AUTORADIOBUTTON,         36, 64, 88, 20,         IDC_CHOUDOUFU,         "长沙臭豆腐",        0    },    {        "button",        WS_VISIBLE | BS_AUTORADIOBUTTON,        36, 90, 88, 20,        IDC_JIANBING,        "山东煎饼",        0    },    {        "button",        WS_VISIBLE | BS_AUTORADIOBUTTON,        36, 116, 88, 20,        IDC_MAHUA,        "天津麻花",        0    },    {        "button",        WS_VISIBLE | BS_AUTORADIOBUTTON,        36, 142, 100, 20,        IDC_SHUIJIAO,        "成都红油水饺",        0    },    {        "static",        WS_VISIBLE | SS_GROUPBOX | WS_GROUP,         160, 10, 70, 160,        IDC_STATIC,        "口味",        0    },    {        "button",        WS_VISIBLE | BS_AUTOCHECKBOX,        170, 38, 50, 20,        IDC_XIAN,        "偏咸",        0    },    {        "button",        WS_VISIBLE | BS_AUTOCHECKBOX | BS_CHECKED,         170, 64, 50, 20,         IDC_LA,         "偏辣",        0    },    {        "static",        WS_VISIBLE | SS_LEFT | WS_GROUP,        16, 180, 360, 20,        IDC_PROMPT,        "西北拉面是面食中的精品,但街上的兰州拉面除外!",        0    },    {        "button",        WS_VISIBLE | BS_DEFPUSHBUTTON | WS_TABSTOP | WS_GROUP,        80, 220, 70, 28,        IDOK,         "确定",        0    },    {        "button",        WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP,        160, 220, 70, 28,        IDCANCEL,        "取消",        0    },};static char* prompts [] = {    "西北拉面是面食中的精品,但街上的兰州拉面除外!",    "长沙臭豆腐口味很独特,一般人适应不了。",    "山东煎饼很难嚼 :(",    "天津麻花很脆,很香!",    "成都的红油水饺可真好吃啊!想起来就流口水。",};static void my_notif_proc (HWND hwnd, int id, int nc, DWORD add_data){    if (nc == BN_CLICKED) {        SetWindowText (GetDlgItem (GetParent (hwnd), IDC_PROMPT), prompts [id - IDC_LAMIAN]);    }}static int DialogBoxProc2 (HWND hDlg, int message, WPARAM wParam, LPARAM lParam){    switch (message) {    case MSG_INITDIALOG:        {            int i;            for (i = IDC_LAMIAN; i <= IDC_SHUIJIAO; i++)                SetNotificationCallback (GetDlgItem (hDlg, i), my_notif_proc);        }        return 1;            case MSG_COMMAND:        switch (wParam) {        case IDOK:        case IDCANCEL:            EndDialog (hDlg, wParam);            break;        }        break;            }        return DefaultDialogProc (hDlg, message, wParam, lParam);}int MiniGUIMain (int argc, const char* argv[]){#ifdef _LITE_VERSION    SetDesktopRect(0, 0, 1024, 768);#endif        DlgYourTaste.controls = CtrlYourTaste;        DialogBoxIndirectParam (&DlgYourTaste, HWND_DESKTOP, DialogBoxProc2, 0L);    return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -