三 在BOOL CSpinnDlg::OnInitDialog()添加代碼,紅色部分
BOOL CSpinnDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 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
SetDlgItemText(IDC_EDIT, _T("0"));
//設置旋轉按鈕的位置范圍
m_ctlSpin.SetRange(-100, 100);
//設置旋轉按鈕的當前位置
m_ctlSpin.SetPos(0);
//設置旋轉按鈕的當前基數
m_ctlSpin.SetBase(1);
//設置旋轉按鈕的伙伴窗口
m_ctlSpin.SetBuddy(GetDlgItem(IDC_EDIT));
return TRUE; // return TRUE unless you set the focus to a control
}