📄 textdialog.cpp
字号:
// TextDialog.cpp : implementation file
//
#include "stdafx.h"
#include "mydialog.h"
#include "TextDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTextDialog dialog
CTextDialog::CTextDialog(CWnd* pParent /*=NULL*/)
: CDialog(CTextDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CTextDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CTextDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTextDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
m_bisCreate=FALSE;
}
BEGIN_MESSAGE_MAP(CTextDialog, CDialog)
//{{AFX_MSG_MAP(CTextDialog)
ON_BN_CLICKED(IDC_Add, OnAdd)
ON_BN_CLICKED(IDC_NUMBER1, OnNumber1)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTextDialog message handlers
void CTextDialog::OnAdd()
{
// TODO: Add your control notification handler code here
/* if (m_bisCreate==FALSE)
{ m_btn.Create("Happy!",WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
CRect(0,0,50,50),this,123);
m_bisCreate=TRUE;
}
else
{
m_btn.DestroyWindow();
m_bisCreate=FALSE;
}*/
int num1,num2,num3;
char ch1[10],ch2[10],ch3[10];
GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,10);
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,10);
num1=atoi(ch1);
num2=atoi(ch2);
num3=num1+num2;
itoa(num3,ch3,10);
GetDlgItem(IDC_EDIT3)->SetWindowText(ch3);
}
void CTextDialog::OnNumber1()
{
// TODO: Add your control notification handler code here
/*CString str;
if(GetDlgItem(IDC_NUMBER1)->GetWindowText(str),str=="Number1:")
{
GetDlgItem(IDC_NUMBER1)->SetWindowText("数值1:");
//}
//else
//{
// GetDlgItem(IDC_NUMBER1)->SetWindowText("Number1:");
//}*/
}
void CTextDialog::OnButton1()
{
// TODO: Add your control notification handler code here
GetDlgItem(IDC_BUTTON1)->MessageBox("OK!");
}
void CTextDialog::OnButton2()
{
// TODO: Add your control notification handler code here
GetDlgItem(IDC_BUTTON2)->MessageBox("THE END!");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -