欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: Spin控件的使用(簡要說明) [打印本頁]

作者: bibi    時間: 2015-4-18 21:34
標題: Spin控件的使用(簡要說明)
Demo
一 利用MFC AppWiard[exe]向導創建一個基于對話框的應用程序MySpin
二 添加控件和變量


編輯框 ID為ID_EDIT,成員變量 CEdit m_ctlEdit;
旋轉按鈕 ID為ID_SPIN,成員變量 CSpinButtonCtrl m_ctlSpin;
三 設置旋轉按鈕屬性


三 在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
}

最后按Ctrl+F5編譯運行








歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1