开发者

CSpinButtonCtrl drawing problem with small CEdit control

开发者 https://www.devze.com 2023-01-20 11:20 出处:网络
I\'m trying to draw a CSpinButtonCtrl as a buddy of an edit box in Windows 7. When my CEdit window is 12 dialog units high, the spin buttons are scaled really badly and the top border is clipped off.

I'm trying to draw a CSpinButtonCtrl as a buddy of an edit box in Windows 7. When my CEdit window is 12 dialog units high, the spin buttons are scaled really badly and the top border is clipped off.

CSpinButtonCtrl drawing problem with small CEdit control

This looks pretty ugly. How can I get around this, or must I restrict my CEdit controls to be 14 dialog units high?

My controls are declared thusly:

EDITTEXT        IDC_LOWER_EDIT,51,20,63,12,ES_MULTILINE | ES_WANTRETURN,W开发者_JS百科S_EX_RIGHT
CONTROL         "",IDC_LOWER_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,104,17,11,12

I've tried resizing using MoveWindow, but that doesn't help. Any ideas?


I found the code for changing the width

CWnd* pWnd = GetDlgItem( IDC_SPIN1 );
CRect rect;
pWnd->GetWindowRect( &rect );
ScreenToClient( &rect );
rect.right += 5 ; // make 5 pixels wider
pWnd->MoveWindow(&rect) ;

Put it in the OnInitDialog().


I think I would go for #2 - are you that pressed for screen space?


Another option is: leave it unattached (remove UDS_ALIGNRIGHT) and place it right next to the edit control.

0

精彩评论

暂无评论...
验证码 换一张
取 消