代码
procedure TResTree.TreeView2MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
p:TPOINT;
Axis_X,Axis_Y:Integer;
VL_Node:TTreeNode;
begin
if Button=mbRight then ~~~这句话出现错误
begin
VL_Node:=TreeView2.GetNodeAt(X,Y);
if (VL_Node<>nil) and (VL_Node.Selected) then
begin
GetCursorPos(p);
Axis_X := p.X;
Axis_Y := p.Y;
PopupMenu1.Popup(Axis_X,Axis_Y);
end;
end;
end;
procedure TResTree.TreeView2MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
p:TPOINT;
Axis_X,Axis_Y:Integer;
VL_Node:TTreeNode;
begin
if Button=mbRight then ~~~这句话出现错误
begin
VL_Node:=TreeView2.GetNodeAt(X,Y);
if (VL_Node<>nil) and (VL_Node.Selected) then
begin
GetCursorPos(p);
Axis_X := p.X;
Axis_Y := p.Y;
PopupMenu1.Popup(Axis_X,Axis_Y);
end;
end;
end;
原先Delphi自动生成的是这样的
interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ActiveX, AxCtrls, ActiveFormProj1_TLB, StdVcl, ExtCtrls, StdCtrls;
改成这样就行了!interfaceuses
ActiveFormProj1_TLB, Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, ActiveX, AxCtrls, StdVcl, ExtCtrls, StdCtrls;