CSpinButtonCtrl draw task with little CEdit control

I am trying to draw CSpinButtonCtrl as a buddy of the editing window in Windows 7. When my CEdit window has 12 dialog levels, the arrow buttons scale very poorly and the top border is cropped.

spin fail

It looks pretty ugly. How can I get around this, or should I limit the CEdit controls to 14 dialog boxes?

My controls are declared as follows:

EDITTEXT        IDC_LOWER_EDIT,51,20,63,12,ES_MULTILINE | ES_WANTRETURN,WS_EX_RIGHT
CONTROL         "",IDC_LOWER_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,104,17,11,12

I tried resizing using MoveWindow, but that does not help. Any ideas?

+5
source share
3 answers

I found code to change 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 OnInitDialog().

+3
source

, # 2 - ?

+2

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

0
source

All Articles