是可以的 unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls; type
TArcanMemo=class(TMemo)
procedure WndProc(var Message : TMessage); override;
procedure WMRButtonUp(var Message: TWMRButtonUp);message WM_RBUTTONUP;
procedure WMCopy(var Message: TWMCopy);message WM_Copy;
procedure WMPaste(var Message: TWMPaste);message WM_Paste;
end; type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1;implementation{$R *.dfm}
procedure TArcanMemo.WMCopy(var Message: TWMCopy);
begin
Message.Result := 1;
end;procedure TArcanMemo.WMPaste(var Message: TWMPaste);
begin
Message.Result := 1;
end;procedure TArcanMemo.WMRButtonUp(var Message: TWMRButtonUp);
begin
Message.Result := 1;
end;procedure TArcanMemo.WndProc(var Message: TMessage);
begin
if (message.Msg =WM_RBUTTONUP) or (message.Msg =WM_RBUTTONDOWN) then
exit;
if (message.Msg =wm_copy) or (message.Msg =wm_cut) then
exit;
if message.Msg =wm_paste then
exit;
inherited WndProc(Message);end;
procedure TForm1.Button1Click(Sender: TObject);
var memo: TArcanMemo;
begin
memo:=TArcanMemo.Create(self);
memo.Parent:=self;
memo.Left:=50;
memo.top:=50;
memo.Height:=50;
memo.Width:=50; end;end.
响应GetFocus()消息,SetCurSel(-1,-1).