试试下面的代码。
procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var dd:TTreeNode;
begin
if button= mbRight then
if treeView1.GetNodeAt(x,y)<>nil then
begin
ShowMessage('yyyyyyyyyyyy');
dd:=TreeView1.GetNodeAt(x,y);
TreeView1.Selected:=dd;
end
else
ShowMessage('nnnnnnnnnnnn');end;
procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var dd:TTreeNode;
begin
if button= mbRight then
if treeView1.GetNodeAt(x,y)<>nil then
begin
ShowMessage('yyyyyyyyyyyy');
dd:=TreeView1.GetNodeAt(x,y);
TreeView1.Selected:=dd;
end
else
ShowMessage('nnnnnnnnnnnn');end;
解决方案 »
- 问下大家,indytcpclient再write的时候同时read会发生什么
- Delphi实现通过字符串执行Published带参方法
- 關於RICHEDIT的使用問題,各位仁兄請進~!
- 各位前輩,救救我吧!
- 怎么计算一个字符串内有几个指定的字符?
- DBGrid 中Lookup字段显示的问题(very 急的,请各位帮帮忙)
- 在调用Table的CreateTable时为什么多出了几个文件?谢谢帮忙!
- 如何实现图形显示
- 请问:怎样使TDBGrid具有XP风格效果?怎样在任意位置产生XP那种冒泡式提示(就像找到新硬件那种)?
- 谁能告诉我SystemParametersInfo这个函数的各个具体参数吗?
- 初学者: 如果我将一个主表,两个从表分别用三个datasource连接并放在dataMod中,我怎样在form调用中实现这三个结果集的主从连接关系
- 请问油箱账号的申请是怎么实现的?
if Button = mbRight then
begin
l_Lparam := x + (y shl 16);//l_lPARAM :LPARAM;
Sendmessage(tvwPersonList.Handle,WM_LBUTTONDOWN ,MK_LBUTTON,L_lparam);
Sendmessage(tvwPersonList.Handle,WM_LBUTTONUP ,MK_LBUTTON,L_lparam);
end;
//这样当点击右键时,treeview也会认为是左键,不好的地方就是当你需要真正想要处理右键的时候会有麻烦,简单的办法可以通过加入标记来分辨。