我们可以使用EM_SETMARGINS设置 RichEdit 控件的左/右页边距的消息。但我不知道如何设置上/下边距。有人知道吗?谢谢。
最佳答案
使用 EM_GETRECT/EM_SETRECT修改所有边距的消息组合:
RECT rc;
// Get the current control rectangle
SendMessage(hWndRichEdit, EM_GETRECT, 0, (LPARAM)&rc);
rc.left += 20; // increase the left margin
rc.top += 20; // increase the top margin
rc.right -= 20; // decrease the right margin
rc.bottom -= 20; // decrease the bottom margin (rectangle)
// Set the rectangle
SendMessage(hWndRichEdit, EM_SETRECT, 0, (LPARAM)&rc);
生成的控件具有所有四个边距:
更新:根据下面的 Barmak Shemirani
和 IInspectable
评论,您可以使用 GetClientRect函数获取当前矩形和InflateRect操作矩形/边距尺寸的函数。
关于c++ - 如何设置 Win32 richedit 的上/下边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39197843/