[IMG]http://programme.tf168.cn/p/r/programme/up/6.jpg[/IMG]
[IMG]http://programme.tf168.cn/p/r/programme/up/7.jpg[/IMG]
方法:(fDialogEx为对话框附加窗体的名称)
Private Sub Command1_Click()
Dim fDlg As New fDialogEx
Dim sRet As String
Dim bSuccess As Boolean
sRet = GetFileName(m_LastPath, "Supported files|*.bmp;*.gif;*.jpg;*.png;*.tif|Bitmap files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif|JPEG files (*.jpg)|*.jpg|PNG files (*.png)|*.png|TIFF files (*.tif)|*.tif", 0, "Open", True, fDlg)
If (sRet <> vbNullString) Then
'-- Get last path
m_LastPath = sRet
'-- Create DIB
DoEvents
Screen.MousePointer = vbHourglass
Call pvSetDIBPicture(pvGetStdPicture(sRet, bSuccess))
Screen.MousePointer = vbNormal
If (bSuccess) Then
'-- Reset Undo/Redo and save first Undo
Call pvClearAllDIB
Call pvSaveUndoDIB
'-- Save info
m_LastFilename = sRet
Call Info_Resize
End If
End If
End Sub
fDialogEx的代码:
Option Explicit
Private Sub Form_Load()
With fMain
'-- Get last status
chkPreview = IIf(.DialogPreview, 1, 0)
chkFitMode = IIf(.DialogFitMode, 1, 0)
Preview.FitMode = .DialogFitMode
sbQuality = .DialogJPEGquality
End With
End Sub
Private Sub chkPreview_Click()
If (chkPreview = 0) Then
Call Preview.DIB.Destroy
Call Preview.Resize
lblSize = "Size:"
End If
fMain.DialogPreview = CBool(chkPreview)
End Sub
Private Sub chkFitMode_Click()
Preview.FitMode = CBool(chkFitMode)
Call Preview.Resize
fMain.DialogFitMode = CBool(chkFitMode)
End Sub
Private Sub sbQuality_Change()
lblQualityV = sbQuality
fMain.DialogJPEGquality = sbQuality
End Sub
Private Sub sbQuality_Scroll()
Call sbQuality_Change
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call Preview.DIB.Destroy
End Sub