📄 js.c
字号:
/* ** $Id: dialogbox.c,v 1.3 2003/06/13 06:50:39 weiym Exp $**** Listing 4.1**** dialogbox.c: Sample program for MiniGUI Programming Guide** Usage of DialogBoxIndirectParam**** 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>//#include"add.c"static BITMAP bmp;static DLGTEMPLATE DlgInitProgress2 ={ WS_BORDER | WS_CAPTION, WS_EX_NONE, 30, 30, 320, 240, "计算器" ,0, 0, 7, NULL, 0};#define IDC_PROMPTINFO 100#define IDC_PROGRESS 110#define BTN_ADD 120#define BTN_DEL 130#define BTN_SER 140#define IDC_B2 60#define IDC_B1 61#define IDC_B3 62#define IDC_B4 63#define IDC_STATIC1 50#define IDC_STATIC2 51char buff[100];static CTRLDATA CtrlInitProgress2 [] ={ { CTRL_SLEDIT,WS_VISIBLE|ES_LEFT|WS_BORDER, 10,30,70,25, IDC_B1,"", 0 }, { CTRL_SLEDIT,WS_VISIBLE|ES_LEFT|WS_BORDER, 100,30,70,25, IDC_B2,"", 0 }, { CTRL_SLEDIT,WS_VISIBLE|ES_LEFT|WS_BORDER|ES_READONLY, 190,30,70,25, IDC_B3,"", 0}, { "static", WS_VISIBLE|SS_CENTER, 80,30,20,25, IDC_STATIC1,"+", 0 }, { "static", WS_VISIBLE|SS_CENTER, 170,30,20,25, IDC_STATIC2, "=", 0 }, { "button",WS_CHILD|BS_PUSHBUTTON|WS_VISIBLE, 180,100,50,25, IDC_B4, "计算", 0}, { "button", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, 180, 150, 50, 25, IDOK, "返回", 0} /*{ "static", WS_VISIBLE | SS_SIMPLE, 10, 10, 380, 16, IDC_PROMPTINFO, "传说中的通讯录", 0 }, { "progressbar", WS_VISIBLE, 10, 40, 380, 20, IDC_PROGRESS, NULL, 0 }, { "button", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, 170, 70, 60, 25, BTN_ADD, "添加", 0 }, { "button", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, 170, 100, 60, 25, BTN_DEL, "删除", 0 }, { "button", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, 170, 130, 60, 25, BTN_SER, "查询", 0 }, { "button", WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, 170, 160, 60, 25, IDOK, "退出", 0 }*/};static int InitDialogBoxProc2(HWND hDlg, int message, WPARAM wParam, LPARAM lParam){ HDC hdc; float temp=0; float sum=0; switch (message) { case MSG_INITDIALOG: break;/*case MSG_ERASEBKGND: hdc = GetClientDC(hDlg); LoadBitmap (HDC_SCREEN, &bmp, "bk1.jpg"); FillBoxWithBitmap(hdc,0,0,320,240,&bmp); Rectangle(hdc,0,0,320,240); ReleaseDC(hdc); return 0;*/ case MSG_COMMAND: switch (wParam) { case IDOK: case IDCANCEL: EndDialog (hDlg, wParam); break; case IDC_B4: { GetWindowText(GetDlgItem(hDlg,IDC_B1),buff,30); if(buff[0]=='\0') temp=0.0; else temp = (float)atof(buff); sum=sum+temp; GetWindowText(GetDlgItem(hDlg,IDC_B2),buff,30); if(buff[0]=='\0') temp=0.0; else temp = (float)atof(buff); sum=sum+temp; sprintf(buff,"%.2f",sum); SetWindowText(GetDlgItem(hDlg,IDC_B3),buff); break; } } break; } return DefaultDialogProc (hDlg, message, wParam, lParam);}void InitDialogBox3 (HWND hWnd){ DlgInitProgress2.controls = CtrlInitProgress2; DialogBoxIndirectParam (&DlgInitProgress2, hWnd, InitDialogBoxProc2, 0L);}/*int MiniGUIMain (int argc, const char* argv[]){#ifdef _LITE_VERSION SetDesktopRect(0, 0, 1024, 768);#endif InitDialogBox (HWND_DESKTOP); return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -