📄 comctldlg.cpp
字号:
// ComctlDlg.cpp : implementation file
//
#include "stdafx.h"
#include "RJ030413.h"
#include "ComctlDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CComctlDlg dialog
CComctlDlg::CComctlDlg(CWnd* pParent /*=NULL*/)
: CDialog(CComctlDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CComctlDlg)
m_nLineWt = 0;
m_nRadius = 0;
//}}AFX_DATA_INIT
}
void CComctlDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CComctlDlg)
DDX_Control(pDX, IDC_SLIDERRADIUS, m_Slider);
DDX_Control(pDX, IDC_SPINLINEWT, m_Spin);
DDX_Text(pDX, IDC_EDITLINEWT, m_nLineWt);
DDV_MinMaxUInt(pDX, m_nLineWt, 0, 10);
DDX_Slider(pDX, IDC_SLIDERRADIUS, m_nRadius);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CComctlDlg, CDialog)
//{{AFX_MSG_MAP(CComctlDlg)
ON_WM_HSCROLL()
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CComctlDlg message handlers
BOOL CComctlDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//..................................
m_BrushBkClr.CreateSolidBrush(RGB(0,0,255));
//........................................................................
//m_Spin.SetBuddy(GetDlgItem(IDC_EDITLINEWT));
m_Spin.SetRange(0,10);
m_Spin.SetPos(1);
m_Slider.SetRange(1,200);
m_Slider.SetTicFreq(8);
m_Slider.SetPos(50);
m_Slider.SetSelection(50,150);
SetDlgItemText(IDC_STATICRADIUS,"半径:50");
//.......................................................................
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CComctlDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
//...........................................................................
if(pScrollBar->GetDlgCtrlID()==IDC_SLIDERRADIUS) m_nRadius=m_Slider.GetPos();
CString strRadius;
strRadius.Format("半径:%d",m_nRadius);
SetDlgItemText(IDC_STATICRADIUS,strRadius);
//..............................................................................
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
HBRUSH CComctlDlg::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 m_BrushBkClr;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -