算了,你们这些懒虫,我给你们把OpenPictureDialog的create和destory贴出来吧!
constructor TOpenPictureDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Filter := GraphicFilter(TGraphic);
FPicture := TPicture.Create;
FPicturePanel := TPanel.Create(Self);
with FPicturePanel do
begin
Name := 'PicturePanel';
Caption := '';
SetBounds(204, 5, 169, 200);
BevelOuter := bvNone;
BorderWidth := 6;
TabOrder := 1;
FPictureLabel := TLabel.Create(Self);
with FPictureLabel do
begin
Name := 'PictureLabel';
Caption := '';
SetBounds(6, 6, 157, 23);
Align := alTop;
AutoSize := False;
Parent := FPicturePanel;
end;
FPreviewButton := TSpeedButton.Create(Self);
with FPreviewButton do
begin
Name := 'PreviewButton';
SetBounds(77, 1, 23, 22);
Enabled := False;
Glyph.LoadFromResourceName(HInstance, 'PREVIEWGLYPH');
Hint := SPreviewLabel;
ParentShowHint := False;
ShowHint := True;
OnClick := PreviewClick;
Parent := FPicturePanel;
end;
FPaintPanel := TPanel.Create(Self);
with FPaintPanel do
begin
Name := 'PaintPanel';
Caption := '';
SetBounds(6, 29, 157, 145);
Align := alClient;
BevelInner := bvRaised;
BevelOuter := bvLowered;
TabOrder := 0;
FPaintBox := TPaintBox.Create(Self);
Parent := FPicturePanel;
with FPaintBox do
begin
Name := 'PaintBox';
SetBounds(0, 0, 153, 141);
Align := alClient;
OnDblClick := PreviewClick;
OnPaint := PaintBoxPaint;
Parent := FPaintPanel;
end;
end;
end;
end;
destructor TOpenPictureDialog.Destroy;
begin
FPaintBox.Free;
FPaintPanel.Free;
FPreviewButton.Free;
FPictureLabel.Free;
FPicturePanel.Free;
FPicture.Free;
inherited Destroy;
end;