1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
void AttachSpinCtrl(int nLower=0,int nUpper=0,CMySpinButtonCtrl *pSpinCtrl=NULL,DWORD dwStyle=UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_SETBUDDYINT);
// ------------------------------------------------------------------
void CMyEdit::AttachSpinCtrl(int nLower,int nUpper,TSpinButtonCtrl *pSpinCtrl,DWORD dwStyle)
{
if(!m_hWnd) return;
m_bSpinNew=FALSE;
if(!pSpinCtrl)
{
CRect rect;
GetWindowRect(&rect);
rect.left=(rect.right-30);
pSpinCtrl=new CMySpinButtonCtrl;
if((dwStyle & UDS_SETBUDDYINT)) dwStyle-=UDS_SETBUDDYINT;
pSpinCtrl->Create(dwStyle| WS_VISIBLE | WS_BORDER | WS_CHILD , rect,GetParent(),GetDlgCtrlID()+10000);
pSpinCtrl->SetWindowPos(this,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
m_bSpinNew=TRUE;
}
m_pSpinCtrl=pSpinCtrl;
if(nLower!=nUpper) m_pSpinCtrl->SetRange(nLower,nUpper);
m_pSpinCtrl->m_nLower=nLower;
m_pSpinCtrl->m_nUpper=nUpper;
m_pSpinCtrl->SetBuddy(this);
m_pSpinCtrl->SetPos(nLower);
} |
Partager