Adding a TOpenPictureDialog Button

I am using Delphi7 under Windows XP. How do I add the addition of the Delete tool to the Delphi TOpenPictureDialog component? Is there a way to get a dialog in the constructor to add a button and its behavior?

+4
source share
2 answers

you can add a new button in the TOpenPictureDialog , but not get the dialog in the constructor, you have to do this at runtime.

check this sample

 procedure TForm1.FormCreate(Sender: TObject); var FDeleteButton : TSpeedButton; FPreviewButton : TSpeedButton; begin FPreviewButton := TSpeedButton(OpenPictureDialog1.FindComponent('PreviewButton')); FDeleteButton := TSpeedButton.Create(OpenPictureDialog1); FDeleteButton.SetBounds(107, 1, 23, 22); FDeleteButton.Parent := FPreviewButton.Parent; FDeleteButton.NumGlyphs:=2; FDeleteButton.Glyph.LoadFromResourceName(HInstance, 'BBABORT'); FDeleteButton.Name := 'DeleteButton'; FDeleteButton.OnClick := DeleteBtnClick; end; procedure TForm1.DeleteBtnClick(Sender: TObject); begin //here you must implement the delete logic ShowMessage('Hello from delete button'); end; 

and result

enter image description here

+5
source

You can write your own OpenDialog and inherit this new class from TOpenPictureDialog. There is a (old) free component called "PBOpenPreviewDialog" that does just that (from TOpenDialog), maybe you can take this component as an example?

You can find the web page at: http://bak-o-soft.dk/Delphi/PBFolderDialog.aspx
And the download link for the component is here: http://bak-o-soft.dk/Download.asgx.ashx/Delphi/PBFolderDialog.zip

0
source

All Articles