📄 如何在richedit中用鼠标右键时光标会落到鼠标这儿 .txt
字号:
如何在richedit中用鼠标右键时光标会落到鼠标这儿
来自:Energy 时间:99-12-2 14:17:32 ID:163738
// 确切的说,在选中状态下是不应该丢失选中文本的。
// 比较全面的做法如下,按右键可以达到很好的你好的效果
procedure TForm1.RxRichEdit1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
TextRange: TCharRange;
atPos:Longint;
mousePoint:TPoint;
begin
if Button = mbRight then
begin
RxRichEdit1.Perform(EM_EXGETSEL,0, Longint(@TextRange));
if TextRange.cpMin<>TextRange.cpMax then
begin
mousePoint.x:=x;
mousePoint.y:=y;
atPos:=RxRichEdit1.Perform(EM_CHARFROMPOS,0,Longint(@mousePoint));
if ( atPosTextRange.cpMax) then
RxRichEdit1.Perform(WM_LBUTTONDOWN, MK_LBUTTON, MakeLong(X, Y));
end
else
RxRichEdit1.Perform(WM_LBUTTONDOWN, MK_LBUTTON, MakeLong(X, Y));
end;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -