spin控件:Spin控件的使用



    在对话框中拖个文本框然后再拖个spinControl控件将其属性设置alignment : right  然后artuo buddy 
    在对话框化中写如下代码:
BOOL CDlgMaterial::OnInitDialog{
       CSpinButtonCtrl *pSpin=(CSpinButtonCtrl *) GetDlgItem(IDC_SPIN1);
       pSpin->SetRange(0,20);
       pSpin->SetPos(10);
} 可以详细对spin进行设置
然后在onscroll编写代码如下:
void CDlgMaterial::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
       CString str;
       double dM;
       CMainFrame * pMain=(CMainFrame *) AfxGetApp->m_pMainWnd;
       CMyARView * arv=(CMyARView*)pMain->GetActiveView;
       CEdit * pE=NULL;
   switch(pScrollBar->GetDlgCtrlID)
   {
    IDC_SPIN1:
          str.Format(\"%f\",(double)nPos/20.0);
          ((CSpinButtonCtrl*)pScrollBar)->GetBuddy->SetWindowText(str);
          pE=(CEdit *)GetDlgItem(IDC_EDIT1) ;
          m_strMR=str;
          dM=atof(m_strMR);
              arv->mat_ambient[0]=dM;
              ;
}
}
Tags:  ajax控件使用 delphi控件使用 vcspin控件 spin控件

延伸阅读

最新评论

发表评论