1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| void CMyEdit::AttachSpinCtrl(DWORD dwStyle)
{
if(!m_bSpin)
{
CRect rect;
GetWindowRect(&rect);
rect.left=(rect.right-30);
pSpinCtrl=new CSpinButtonCtrl;
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_pSpinCtrl=pSpinCtrl;
m_pSpinCtrl->SetRange(-180,180);
m_pSpinCtrl->SetBuddy(this);
m_pSpinCtrl->SetPos(180);
} |