Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

PrintPreview Sample (VB6)

This sample illustrates SftDirectory and SftPrintPreview/OCX to print and preview file/folder listings.

The source code is located at C:\Program Files (x86)\Softelvdm\SftDirectory 3.5\Samples\VB6\PrintPreview\Form1.frm or C:\Program Files\Softelvdm\SftDirectory 3.5\Samples\VB6\PrintPreview\Form1.frm (on 32-bit Windows versions).

Option Explicit

Private Sub AppExit_Click()
    End
End Sub

Private Sub Form_Resize()
    SftPrintPreview1.Move 0, 0, ScaleWidth, ScaleHeight
    SftDirectory1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub

Private Sub Form_Load()
    ' Connect the directory control to the print preview control
    SftPrintPreview1.ContentProvider = SftDirectory1.Window
    ' display directory
    Form1.Show
    Form1.SetFocus
    ViewDirectory_Click
    SftPrintPreview1.ZoomFactor = 100
End Sub

Private Sub ViewDirectory_Click()
    ' Show the SftDirectory control
    SftDirectory1.Visible = True
    SftDirectory1.Enabled = True
    SftDirectory1.SetFocus
    ' Disable & hide the print preview control
    SftPrintPreview1.Visible = False
    SftPrintPreview1.Enabled = False
End Sub

Private Sub Preview_Click()
    ' Disable & hide the SftDirectory control
    SftDirectory1.Visible = False
    SftDirectory1.Enabled = False
    ' Show the print preview control
    SftPrintPreview1.Enabled = True
    SftPrintPreview1.Visible = True
    SftPrintPreview1.SetFocus
    ' In case the SftDirectory control changed, we have to reformat everything
    SftPrintPreview1.Restart restartSftPrintPreviewComplete
End Sub

Private Sub SftPrintPreview1_PageSetupWanted()
    SftPrintPreview1.PageSetup 0
End Sub

Private Sub SftPrintPreview1_HelpWanted(ByVal HelpName As String)
    MsgBox ("Sorry, this sample doesn't offer a help file")
End Sub

Private Sub SftPrintPreview1_CloseWanted()
    ViewDirectory_Click
End Sub

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.