Example 1 Open
This example shows how to use the ImgAdmin Open dialog box to display a file in the Image Edit and the Thumbnail controls.
Private Sub cmdDisplay_Click()
'Initialize the Image property to check for Cancel pressed.
'When the dialog box is shown, check for a value in the
'Image property.
ImgAdmin1.Image = ""
'Specify a dialog title and a list filter rather than using
'the defaults.
ImgAdmin1.DialogTitle = "Select Image for Display"
ImgAdmin1.Filter = "All Image Files |*.bmp; *.jpg; *.tif|
Bitmap Files(*.bmp)|*. bmp| JPG Files (*.jpg)|*.jpg|
TIFF Files (*.tif)|*.tif|All Files (*.*)|*.*|"
' Default filter will be TIFF (fourth item).
ImgAdmin1.FilterIndex = 4
'Set the InitDir property to the preferred directory.
ImgAdmin1.InitDir = "C:\images"
ImgAdmin1.CancelError = False
'Note: if you have Server Access software installed this
'will automatically be enabled in the Open dialog box after
'the user authenticates.
ImgAdmin1.ShowFileDialog OpenDlg, Form1.hWnd
'Determine if a file was selected or cancel was pressed
If ImgAdmin1.Image = "" Then Exit Sub
'Set the image properties in the Image Edit and Thumbnail controls
'to the name of the file selected in the dialog box.
ImgEdit1.Image = ImgAdmin1.Image
ImgThumbnail1.Image = ImgAdmin1.Image
'Display the image in the ImgEdit and Thumbnail control.
ImgEdit1.Display
End Sub
Example 2 SaveAs
This example saves the displayed image with a new filename using the Admin Save dialog and the Image Edit control SaveAs method.
Private Sub cmdSaveAs_Click()
ImgAdmin1.ShowFileDialog SaveDlg
ImgEdit1.SaveAs ImgAdmin1.Image
End Sub