Posts: 88
Threads: 33
Joined: Feb 2007
Hi,
How can I set the background color of richedit field completely...not only for the amount of text in it. (See attached image)
My code in dlg :
case WM_CTLCOLORSTATIC
if(lParam=id(8 hDlg) or lParam=id(9 hDlg))
SetBkColor wParam 0xffffff
SetTextColor wParam 0x663300
ret 0xffffff
Posts: 12,073
Threads: 140
Joined: Dec 2002
Function Dialog_richedit_colors
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
def CFM_BOLD 0x00000001
def CFM_ITALIC 0x00000002
def CFM_UNDERLINE 0x00000004
def CFM_STRIKEOUT 0x00000008
def CFM_PROTECTED 0x00000010
def CFM_LINK 0x00000020
def CFM_SIZE 0x80000000
def CFM_COLOR 0x40000000
def CFM_FACE 0x20000000
def CFM_OFFSET 0x10000000
def CFM_CHARSET 0x08000000
def CFE_BOLD 0x0001
def CFE_ITALIC 0x0002
def CFE_UNDERLINE 0x0004
def CFE_STRIKEOUT 0x0008
def CFE_PROTECTED 0x0010
def CFE_LINK 0x0020
def CFE_AUTOCOLOR 0x40000000
def SCF_SELECTION 0x0001
def SCF_WORD 0x0002
def SCF_DEFAULT 0x0000
def SCF_ALL 0x0004
type CHARFORMAT cbSize dwMask dwEffects yHeight yOffset crTextColor !bCharSet !bPitchAndFamily !szFaceName[LF_FACESIZE]
str controls = "3"
str rea3
rea3="rich text"
if(!ShowDialog("Dialog_richedit_colors" &Dialog_richedit_colors &controls)) ret
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 RichEdit20A 0x54233044 0x200 0 0 222 84 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010703 "*" ""
ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam)
,int h(id(3 hDlg)) bcol(0x000000) tcol(0x00FF00)
,
,SendMessage h EM_SETBKGNDCOLOR 0 bcol
,
,CHARFORMAT cf.cbSize=sizeof(CHARFORMAT)
,cf.dwMask=CFM_COLOR|CFM_BOLD|CFM_FACE|CFM_SIZE
,cf.crTextColor=tcol
,cf.dwEffects=CFE_BOLD
,strncpy(&cf.szFaceName "Comic Sans MS" 31)
,cf.yHeight=400 ;;twips
,
,SendMessage h EM_SETCHARFORMAT SCF_ALL &cf
,
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
Posts: 88
Threads: 33
Joined: Feb 2007