demokey.cpp
来自「winsail v2.0是用于DOS下的图形界面空间系统」· C++ 代码 · 共 81 行
CPP
81 行
#include <Symbol.h>
#include <MyFrame.h>
void far VirtualKeyboardDemo(CObject* pCurObj)
{
//Create a Dialog On the Center of Desktop
CDialog* pDialog = new CDialog;//分配实例
pDialog->CreateWindow(0, 0, 640, 360, "触摸屏虚拟键盘演示");//建立窗口
pDialog->Center();//窗口对中
//Register Callback Function for Window
pDialog->SetTimeFc(NULL);//注册定时器回调函数
pDialog->SetDrawFc(NULL);//注册画图回调函数
pDialog->SetHelpFc(NULL);//注册帮助回调函数
pDialog->SetKeyboardFc(NULL);//注册虚拟键盘回调函数
//Create Close's Button Control
new CCloseButton(pDialog);//分配和建立关闭按钮
//Create Edit Control
CEdit* pEdit1 = new CEdit(pDialog);
pEdit1->CreateObject(60, 53-20, 250, 21, NULL);
pEdit1->SetID(EDITBASE + 1 - 1);
//Create Edit Control
CEdit* pEdit2 = new CEdit(pDialog);
pEdit2->CreateObject(380, 53-20, 250, 21, NULL);
pEdit2->SetID(EDITBASE + 2 - 1);
//Create a Label Control
CLabel* pLabel3 = new CLabel(pDialog);
pLabel3->CreateObject(5, 53-20, 31, 12, "Key1:");
//Create a Label Control
CLabel* pLabel4 = new CLabel(pDialog);
pLabel4->CreateObject(325, 53-20, 31, 12, "Key2:");
CComboBox* pComboBox1 = new CComboBox(pDialog);
pComboBox1->CreateCombo(5, 60, 150, 16 + 8, NULL);
pComboBox1->SetCount(3);
pComboBox1->SetSel(0,"小媚");
pComboBox1->SetSel(1,"小花");
pComboBox1->SetSel(2,"小靖");
CKeyboardCtrl* pKeyboardCtrl1 = new CKeyboardCtrl(pDialog);
pKeyboardCtrl1->CreateObject(3,120 + 0 * 20, 100, 100, NULL);
pKeyboardCtrl1->SetAttrib(0, 1);
CKeyboardCtrl* pKeyboardCtrl2 = new CKeyboardCtrl(pDialog);
pKeyboardCtrl2->CreateObject(3,120 + 2 * 20, 100, 100, NULL);
pKeyboardCtrl2->SetAttrib(0, 2);
CKeyboardCtrl* pKeyboardCtrl3 = new CKeyboardCtrl(pDialog);
pKeyboardCtrl3->CreateObject(3,120 + 5 * 20, 100, 100, NULL);
pKeyboardCtrl3->SetAttrib(0, 4);
CKeyboardCtrl* pKeyboardCtrl4 = new CKeyboardCtrl(pDialog);
pKeyboardCtrl4->CreateObject(323,120 + 6 * 20, 100, 100, NULL);
pKeyboardCtrl4->SetAttrib(0, 3);
CKeyboardCtrl* pKeyboardCtrl5 = new CKeyboardCtrl(pDialog);
pKeyboardCtrl5->CreateObject(323,120 + 0 * 20, 100, 100, NULL);
pKeyboardCtrl5->SetAttrib(0, 5);
//Show Window
pDialog->ShowWindow();//显示窗口
//go into Message Loop
pDialog->DoModal();//进入窗口消息循环
//Destroy Window
delete pDialog;//删除对话框
return;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?