如果連同子控件一起復制到剪切板
譬如在一個 TPanel 中包含一個 TEdit
運行效果圖
TMyPanel 類的單元
unit MyPanel;
interface
uses Classes
type
TMyPanel = class(TPanel)
Edit
constructor Create(AOwner: TComponent); override;
end;
implementation
{ TMyPanel }
constructor TMyPanel
begin
inherited;
Edit
Edit
Edit
Edit
RegisterClasses([TMyPanel]); {在這裡就給注冊了}
end;
測試單元
unit Unit
interface
uses
Windows
Dialogs
type
TForm
Button
Button
procedure FormCreate(Sender: TObject);
procedure Button
procedure Button
end;
var
Form
implementation
{$R *
uses Clipbrd
var
obj: TComponent;
pnl: TMyPanel;
procedure TForm
begin
pnl := TMyPanel
pnl
pnl
Button
Button
end;
procedure TForm
begin
Clipboard
end;
procedure TForm
begin
if Clipboard
begin
obj := Clipboard
TMypanel(obj)
TMypanel(obj)
end;
end;
From:http://tw.wingwit.com/Article/program/Delphi/201311/8411.html