PDA

View Full Version : RichEdit background control color



ErosOlmi
21-09-2006, 02:34
To change backgound color of a rich edit control area.

To do it, just send the following message to the richedit control, where lColor is the color number you want to assign to the control:

sendmessage hEdit, %EM_SETBKGNDCOLOR, 0, lColor

An example getting color from standard color dialog:

lColor = Dialog_ChooseColor(hDlg, rgb(255, 0, 0), %CC_RGBINIT OR %CC_FULLOPEN )
if lColor <> -1 then
sendmessage hEdit, %EM_SETBKGNDCOLOR, 0, lColor
end if

Here it is a Microsoft reference page on rich edit notification message list:
http://windowssdk.msdn.microsoft.com/en-us/library/ms651298.aspx

ErosOlmi
21-09-2006, 08:11
Remember that "SendMessage ..." API function has its "CONTROL SEND ..." version.
For example :

SendMessage hEdit, %EM_SETBKGNDCOLOR, 0, lColor
if the same of

CONTROL SEND hDlg, %ID_Editor, %EM_SETBKGNDCOLOR, 0, lColor

They do exactly the same.
The difference is that SendMessage needs the internal window handle of the control while CONTROL SEND needs the handle of the window you have created plus your control id.

catventure
21-09-2006, 08:31
Thanks Eros for that.



SendMessage hEdit, %EM_SETBKGNDCOLOR, 0, lColor


The new RTF functions in latest preview are working great!

catventure