⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 如何在richedit中用鼠标右键时光标会落到鼠标这儿 .txt

📁 大量Delphi开发资料
💻 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 + -