宝兰很不赞成这种做法,但是这种做法的确是很简单的.喝喝.绝对精采.加分.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls;
type
TForm1 = class(TForm)
TreeView1: TTreeView;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
FWindowProc:TWndMethod;
procedure ProcWindowProc(var Message: TMessage);
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.ProcWindowProc(var Message: TMessage);
begin
if Message.Msg=WM_LBUTTONDBLCLK then
Message.Msg:=WM_LBUTTONUP;
FWindowProc(Message);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FWindowProc:=TreeView1.WindowProc;
TreeView1.WindowProc:=ProcWindowProc;
end;
end.