TRichEdit Help(100分)

  • 主题发起人 主题发起人 lshiren
  • 开始时间 开始时间
L

lshiren

Unregistered / Unconfirmed
GUEST, unregistred user!
可不可以隐藏TRichEdit的字符插入符(Caret)?
 
你的目的到底是什么?我想应该可使用API将此CARET隐去的。
 
code:
set form.keypreview=true

set richedit.enable:=false

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
RichEdit1.Text:=RichEdit1.Text+chr(Key);
end;
效果一般,应有其它更好的办法!
 
Windows has an API function HideCaret to do this job:
function HideCaret(wnd: hwnd): boolean;
You can apply this function in then RichEdit control's event. The
following example will hide the caret after any key is released.

procedure TForm1.RichEdit1KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
hidecaret(richedit1.handle);
end;

You can also use this function in another event of the richedit, like
OnEnter...
 
多人接受答案了。
 
后退
顶部