Link to home
Start Free TrialLog in
Avatar of Olympus
Olympus

asked on

RichEdit border problem (using API, not MFC)

I would like to increase the borders (more specifically, the spacing between text and the sides) of my dynamically created richedit control, much like the TRichEdit.BorderWidth property in Delphi. I have tried, according to the API docs, sending the EM_SETPARAFORMAT message with the wBorder and wBorderWidth fields filled out in the PARAFORMAT2 structure to no avail. As a matter of fact, no matter what values I plug in, nothing seems to happen. Anyone else run into this sort of thing?

     g_hRichEdit = CreateWindowEx(WS_EX_CLIENTEDGE, RICHEDIT_CLASS, 0, WS_VISIBLE | ES_MULTILINE |
          ES_READONLY | WS_CHILD | WS_VSCROLL | ES_AUTOVSCROLL | ES_NOHIDESEL, 0, 0, 0, 0, g_wMain, 0, g_hInstance, 0);
     SendMessage(g_hRichEdit, WM_SETFONT, (WPARAM)hFont, TRUE);
     PARAFORMAT2 pf2;

     memset(&pf2, 0, sizeof(pf2));
     pf2.cbSize = sizeof(pf2);
     pf2.dwMask = PFM_BORDER;
     pf2.wBorderSpace = 0;
     pf2.wBorderWidth = 5000;
     pf2.wBorders = 0x20 | 0x400 | 0x5000; //

     SendMessage(g_hRichEdit, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
ASKER CERTIFIED SOLUTION
Avatar of DenL
DenL

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Olympus
Olympus

ASKER

Many thanks.