📄 edit.c
字号:
/* ** $Id: edit.c,v 1.4 2003/07/04 08:29:13 weiym Exp $**** Listing 9.1**** edit.c: Sample program for MiniGUI Programming Guide** Usage of EDIT 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>static DLGTEMPLATE DlgBoxInputChar ={ WS_BORDER | WS_CAPTION, WS_EX_NONE, 10, 10, 300, 210, "请键入字母", 0, 0, 4, NULL, 0};#define IDC_CHAR 100#define IDC_CHARS 110static CTRLDATA CtrlInputChar [] ={ { CTRL_STATIC, WS_VISIBLE | SS_CENTER, 10, 10, 300, 18, IDC_STATIC, "请输入一个字母:", 0 }, { CTRL_SLEDIT, WS_VISIBLE | WS_TABSTOP | WS_BORDER, 120, 40, 40, 34, IDC_CHAR, NULL, 0 }, { CTRL_MLEDIT, WS_VISIBLE | WS_BORDER | WS_VSCROLL | ES_BASELINE | ES_AUTOWRAP, 10, 80, 280, 70, IDC_CHARS, "", 0 }, { CTRL_BUTTON, WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, 120, 160, 60, 25, IDOK, "确定", 0 }};static void my_notif_proc (HWND hwnd, int id, int nc, DWORD add_data){ if (nc == EN_CHANGE) { char buff [5]; GetWindowText (hwnd, buff, 4); SendMessage (hwnd, EM_SETCARETPOS, 0, 0); SendMessage (GetDlgItem (GetParent (hwnd), IDC_CHARS), MSG_CHAR, buff[0], 0L); }} static int InputCharDialogBoxProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam){ static PLOGFONT my_font; HWND hwnd; switch (message) { case MSG_INITDIALOG: my_font = CreateLogFont (NULL, "Arial", "ISO8859-1", FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL, FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE, 30, 0); hwnd = GetDlgItem (hDlg, IDC_CHAR); SetNotificationCallback (hwnd, my_notif_proc); SetWindowFont (hwnd, my_font); SendMessage (hwnd, MSG_KEYDOWN, SCANCODE_INSERT, 0L); return 1; case MSG_COMMAND: switch (wParam) { case IDOK: case IDCANCEL: DestroyLogFont (my_font); 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); if (!InitVectorialFonts ()) { printf ("InitVectorialFonts: error.\n"); return 1; }#endif DlgBoxInputChar.controls = CtrlInputChar; DialogBoxIndirectParam (&DlgBoxInputChar, HWND_DESKTOP, InputCharDialogBoxProc, 0L);#ifdef _LITE_VERSION TermVectorialFonts ();#endif return 0;}#ifndef _LITE_VERSION#include <minigui/dti.c>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -