c++ - How to set the top/bottom margins of a Win32 richedit -
we can use em_setmargins message set left/right margins of richedit control. don't know how set top/bottom margins. body knows? thanks.
use em_getrect / em_setrect message combination modify margins:
rect rc; // current control rectangle sendmessage(hwndrichedit, em_getrect, 0, (lparam)&rc); rc.left += 20; // increase left margin rc.top += 20; // increase top margin rc.right -= 20; // decrease right margin rc.bottom -= 20; // decrease bottom margin (rectangle) // set rectangle sendmessage(hwndrichedit, em_setrect, 0, (lparam)&rc);
the resulting control has 4 margins:
update: per barmak shemirani
, iinspectable
comments below use getclientrect function current rectangle , inflaterect function manipulate rectangle / margin dimensions.
Comments
Post a Comment