I try to set the TRichEdit
control default paragraph bg color with this code:
//******************************************************************************
class procedure TRichEditUtility.setBGColor( aRE_ : TTNTRichEdit; bgColor_ : cardinal; default_ : boolean = FALSE );
//******************************************************************************
var
cf: TCharFormat2;
begin
if ( aRE_ <> NIL ) then
begin
fillchar(cf, sizeof(cf), 0);
cf.cbSize := sizeof( cf );
cf.dwMask := CFM_BACKCOLOR;
cf.crBackColor := bgColor_;
if ( default_ ) then
aRE_.Perform( EM_SETCHARFORMAT, SPF_SETDEFAULT, lparam(@cf) )
else
aRE_.Perform( EM_SETCHARFORMAT, SCF_SELECTION, lparam(@cf) );
end else
raise EInvalidInputParameter.create_string( 'TRichEditUtility', 'setBGColor', 'aRE_', CONST_chars_NIL );
end;
But the value of the SPF_SETDEFAULT
constant is unknown!
Can somebody tell me its value? (Or the file name which define its value)
Here is how to resolve this issue, and any issue of this nature.
SPF_SETDEFAULT
.EM_SETCHARFORMAT
.Richedit.h
as the required header.Richedit.h
in your copy of the Windows SDK and search for SPF_SETDEFAULT
.#define SPF_SETDEFAULT 0x0004
.const SPF_SETDEFAULT = $0004
.