📄 picturebutton2dlg.cpp
字号:
// PictureButton2Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "PictureButton2.h"
#include "PictureButton2Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPictureButton2Dlg dialog
CPictureButton2Dlg::CPictureButton2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CPictureButton2Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPictureButton2Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CPictureButton2Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPictureButton2Dlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPictureButton2Dlg, CDialog)
//{{AFX_MSG_MAP(CPictureButton2Dlg)
ON_BN_CLICKED(IDC_STATIC_Btn, OnSTATICBtn)
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_STATIC_BigPicture, OnSTATICBigPicture)
ON_WM_TIMER()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPictureButton2Dlg message handlers
BOOL CPictureButton2Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
COLORREF clrCtlBk = RGB(255, 255, 255);
BKBR = CreateSolidBrush(clrCtlBk);
//SetTimer(1,1000,NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
void CPictureButton2Dlg::OnSTATICBtn()
{
// TODO: Add your control notification handler code here
GetDlgItem(IDC_STATIC_BigPicture)->ShowWindow(SW_SHOWNORMAL);
UpdateWindow();
Sleep(600);
GetDlgItem(IDC_STATIC_BigPicture)->ShowWindow(SW_HIDE);
SendMessage(WM_PAINT);
CString OutPutCstring;
OutPutCstring.LoadString(IDS_String);
MessageBox(OutPutCstring);
}
HBRUSH CPictureButton2Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
//HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
//return hbr;
return BKBR;
}
void CPictureButton2Dlg::OnSTATICBigPicture()
{
// TODO: Add your control notification handler code here
}
void CPictureButton2Dlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
GetDlgItem(IDC_STATIC_BigPicture)->ShowWindow(SW_HIDE);
CDialog::OnTimer(nIDEvent);
}
void CPictureButton2Dlg::GoBack()
{
Sleep(2000);
GetDlgItem(IDC_STATIC_BigPicture)->ShowWindow(SW_HIDE);
MessageBox(_T("I Love China!"));
}
int CPictureButton2Dlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
lpCreateStruct->cx = 10;
lpCreateStruct->cy = 10;
lpCreateStruct->lpszName = _T("jay_lee_1982");
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -