delphi RichEdit选中文字右键菜单的实现


本文整理自网络,侵删。

 
procedure TForm1.RichEdit1MouseDown(Sender: TObject; Button: TMouseButton;
 Shift: TShiftState; X, Y: Integer);
var
 vPoint: TPoint;
begin
 if Button <> mbRight then Exit;
 vPoint := Point(X, Y);
 X := SendMessage(RichEdit1.Handle, EM_CHARFROMPOS,0,
    Integer(@vPoint)) and $0000FFFF;// 得到鼠标点击字符位置
 if (X >= RichEdit1.SelStart) and
    (X <= RichEdit1.SelStart + RichEdit1.SelLength) then
    ShowMessage(RichEdit1.SelText);
end;

来路:http://www.cnblogs.com/key-ok/p/3359027.html

相关阅读 >>

Delphi xe 在andriod程序中获取外置sd卡根目录

Delphi xe2读取内存偏移数据代码

Delphi tfdmemtable 更新到数据库

Delphi d10.x 并行库ppl编程之ttask

Delphi trystrtoint字符转换成整数

Delphi winapi: getwindowthreadprocessid - 获取指定窗口的进程 id 或线程 id

Delphi 中使用微软全文翻译的小例子

Delphi tdbgrideh导出excel

Delphi 快速读取txt 指定行的数据

Delphi将图片缩放成指定大小

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...