Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

PrintPreview Sample (VB.NET)

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\Visual Studio - VB.NET\PrintPreview\Form1.vb or C:\Program Files\Softelvdm\SftDirectory 3.5\Samples\Visual Studio - VB.NET\PrintPreview\Form1.vb (on 32-bit Windows versions).

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Connect the directory control to the print preview control
    AxSftPrintPreview1.ContentProvider = AxSftDirectory1.Window
    ' display directory
    ShowDirectory()
    AxSftPrintPreview1.ZoomFactor = 100
    ' maximize window
    WindowState = FormWindowState.Maximized
End Sub

Private Sub ShowDirectory()
    ' Show the SftDirectory control
    AxSftDirectory1.Visible = True
    AxSftDirectory1.Enabled = True
    AxSftDirectory1.Dock = DockStyle.Fill
    PerformLayout()
    AxSftDirectory1.Focus()
    ' Disable & hide the print preview control
    AxSftPrintPreview1.Visible = False
    AxSftPrintPreview1.Enabled = False
End Sub

Private Sub ShowPreview()
    ' Show the print preview control
    AxSftPrintPreview1.Visible = True
    AxSftPrintPreview1.Enabled = True
    AxSftPrintPreview1.Dock = DockStyle.Fill
    PerformLayout()
    AxSftPrintPreview1.Focus()
    ' Disable & hide the SftDirectory control
    AxSftDirectory1.Visible = False
    AxSftDirectory1.Enabled = False
End Sub

Private Sub AxSftPrintPreview1_PageSetupWanted(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftPrintPreview1.PageSetupWanted
    AxSftPrintPreview1.PageSetup(0)
End Sub

Private Sub AxSftPrintPreview1_HelpWanted(ByVal sender As Object, ByVal e As AxSftPrintPreviewLib10._ISftPrintPreviewEvents_HelpWantedEvent) Handles AxSftPrintPreview1.HelpWanted
    MessageBox.Show("Sorry, this sample doesn't offer a help file")
End Sub

Private Sub AxSftPrintPreview1_CloseWanted(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftPrintPreview1.CloseWanted
    ShowDirectory()
End Sub

Private Sub menuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuExit.Click
    Application.Exit()
End Sub

Private Sub menuDirectory_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuDirectory.Click
    ShowDirectory()
End Sub

Private Sub menuPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuPreview.Click
    ShowPreview()
End Sub
End Class

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