Home > Back-end >  By sending a message to set up the mechanism of rich text box font style color and size
By sending a message to set up the mechanism of rich text box font style color and size

Time:09-15

SendMessage (H, EM_SETCHARFORMAT,? ,?) ;

Or

SendMessage (H, WM_SETFONT,? ,?) ;

CodePudding user response:

Should not through the message mechanism to style to set the Font color and size, because if the Font color and size changes, the system USES the message mechanism to change, according to the direct effect of or the original Font,

This is the system in the source code:
 
Procedure WMSetFont (var Message: TWMSetFont); The message WM_SETFONT;

Procedure TCustomRichEdit. WMSetFont (var Message: TWMSetFont);
The begin
FDefAttributes. Assign (Font);
The end;

CodePudding user response:

reference 1st floor tanqth response:
should not through the message mechanism to style to set the Font color and size, because if the Font color and size changes, the system USES the message mechanism to change, according to the direct effect of or the original Font,

This is the system in the source code:
 
Procedure WMSetFont (var Message: TWMSetFont); The message WM_SETFONT;

Procedure TCustomRichEdit. WMSetFont (var Message: TWMSetFont);
The begin
FDefAttributes. Assign (Font);
The end;


WMSetFont is ok, but I use after, he will be all the word format back into the default format,

EM_SETCHARFORMAT this I also tried, but can make tablet program crash,


CodePudding user response:

refer to the second floor lyq strong response:
Quote: refer to 1st floor tanqth response:
should not through the message mechanism to style to set the Font color and size, because if the Font color and size changes, the system USES the message mechanism to change, according to the direct effect of or the original Font,

This is the system in the source code:
 
Procedure WMSetFont (var Message: TWMSetFont); The message WM_SETFONT;

Procedure TCustomRichEdit. WMSetFont (var Message: TWMSetFont);
The begin
FDefAttributes. Assign (Font);
The end;


WMSetFont is ok, but I use after, he will be all the word format back into the default format,

EM_SETCHARFORMAT this I also tried, but can make tablet program crash,




"He will be all the word format back into the default format,"
It is not ok, can, change the format for you need,

CodePudding user response:

Source code has to come out, when the system receives the WMSetFont, will only perform FDefAttributes. Assign (Font);
Any information in the SendMessage meaningless, of course, you can modify the source code,

CodePudding user response:

reference 4 floor tanqth response:
source has to come out, when the system receives the WMSetFont, will only perform FDefAttributes. Assign (Font);
Any information in the SendMessage meaningless, of course, you can modify the source code first,


WMSetFont source is certainly not modify
I did a test, add text to the clipboard, using spy++ access tablet access, and then use EM_SETCHARFORMAT send messages, but the news will make tablet crash,,,
You used the EM_SETCHARFORMAT news? Said that this can be online, but I don't know exactly how to use
  • Related