📄 imagetextbtndemodlg.cpp
字号:
// ImageTextBtnDemoDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ImageTextBtnDemo.h"
#include "ImageTextBtnDemoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CImageTextBtnDemoDlg dialog
CImageTextBtnDemoDlg::CImageTextBtnDemoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CImageTextBtnDemoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CImageTextBtnDemoDlg)
// 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);
//Creating the brush for paining back ground of the control dialog
m_brBckColor.CreateSolidBrush(RGB(29,28,31));
}
void CImageTextBtnDemoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CImageTextBtnDemoDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CImageTextBtnDemoDlg, CDialog)
//{{AFX_MSG_MAP(CImageTextBtnDemoDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_ENABLE_BTN, OnEnable)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CImageTextBtnDemoDlg message handlers
BOOL CImageTextBtnDemoDlg::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
// TODO: Add extra initialization here
m_btnOK.SetButtonImg(IDB_OKU,IDB_OKD);
m_btnOK.SetButtonText("OK");
m_btnOK.SetFont("Arial",16);
m_btnOK.SetTextColor(RGB(255,0,0),RGB(129,129,129));
m_btnOK.SubclassDlgItem(IDOK,this);
m_btnPlay.SetButtonImg(IDB_PLAYU,IDB_PLAYD,IDB_PLAYX);
m_btnPlay.SubclassDlgItem(IDC_PLAY_BTN,this) ;
m_btnStrt.SetButtonImg(IDB_STRTU,IDB_STRTD,IDB_STRTX);
m_btnStrt.SetButtonText("Start");
m_btnStrt.SetFont("Arial",14);
m_btnStrt.SetTextPosition(7,3);
m_btnStrt.SetTextColor(RGB(0,255,255),RGB(129,129,129));
m_btnStrt.SubclassDlgItem(IDC_STRT_BTN,this) ;
m_btnEnable.SetButtonImg(IDB_OKU,IDB_OKD);
m_btnEnable.SetButtonText("E/D able");
m_btnEnable.SetFont("Times New Roman",12);
m_btnEnable.SetTextColor(RGB(0,255,0),RGB(0,255,0));
m_btnEnable.SubclassDlgItem(IDC_ENABLE_BTN,this) ;
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CImageTextBtnDemoDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rectArea;
GetClientRect(&rectArea);
dc.FillRect(rectArea.operator LPRECT(),&m_brBckColor);
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CImageTextBtnDemoDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CImageTextBtnDemoDlg::OnEnable()
{
// TODO: Add your control notification handler code here
CWnd* pWnd = GetDlgItem(IDOK);
if(pWnd->IsWindowEnabled())
pWnd->EnableWindow(FALSE);
else
pWnd->EnableWindow(TRUE);
pWnd = GetDlgItem(IDC_PLAY_BTN);
if(pWnd->IsWindowEnabled())
pWnd->EnableWindow(FALSE);
else
pWnd->EnableWindow(TRUE);
pWnd = GetDlgItem(IDC_STRT_BTN);
if(pWnd->IsWindowEnabled())
pWnd->EnableWindow(FALSE);
else
pWnd->EnableWindow(TRUE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -