How To ...
  Create a Custom Print Dialogue with dbiSchedule.dll
A common request from many customers - "is it possible to create our own custom print preview dialogue? "  Absolutely, and here's how you can go about doing just that:

Public Class CustomPrintPreviewDialog

    Inherits PrintPreviewDialog



    Public Sub New()


        ' This call is required by the Windows Form Designer.



        ' Add any initialization after the InitializeComponent() call.


    End Sub


    Public Sub New(ByVal Title As String, ByVal PrintDoc As Printing.PrintDocument)



        Text = Title

        Document = PrintDoc


    End Sub

End Class

Public Class Form1

    Private Sub DbiSchedule1_FirstDraw(ByVal sender As Object, ByVal e As Dbi.WinControl.Schedule.FirstDrawEventArgs) Handles DbiSchedule1.FirstDraw

'Create some test data, so there's something to PrintPreview

   Dim cntItem As Integer

        Dim curSched As New Dbi.WinControl.Schedule.dbiScheduleObject

        curSched.Start = #1/1/2012 1:00:00 AM#
        curSched.End = #1/1/2012 11:00:00 PM#


        For cntItem = 1 To 10
            Dim newItem As New Dbi.WinControl.Schedule.dbiScheduleItem
            newItem.Text = "Test " & cntItem.ToString

            Dim x As New Dbi.WinControl.Schedule.dbiTimeBarItem
            x.Start = #1/1/2012#.AddHours(Int(Rnd(1) * 6))
            x.End = x.Start.AddHours(Int(Rnd(1) * 6))


x = New Dbi.WinControl.Schedule.dbiTimeBarItem
            x.Start = #1/1/2012#.AddHours(Int(Rnd(1) * 6) + 12)
            x.End = x.Start.AddHours(Int(Rnd(1) * 6))




    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        'Create a new instance of the custom PrintPreviewDialog dialog with the PrintDocument object from the dbi Schedule control.

        'The overload receives the customized text to display as the title on the dialog, as well as the PrintDocument
        'to be previewed. 

        Dim myPreview As New CustomPrintPreviewDialog("My Custom Preview Dialog", Me.DbiSchedule1.ScheduleDocument)

        'Show the custom print preview dialog displaying the PrintDocument object, returned from the Schedule's ScheduleDocument method.


    End Sub

End Class

And voila ...


As always from all of us here in support, take care and have a great day!


    DBI Support Products Downloads  Purchase
    Customers Support Request Form Warehouse Shipments Scheduling Framework Trial Downloads Order Page
    News Releases FAQ Studio Controls for .NET
    Contact Us License Registration Studio Controls for COM
  Updates Solutions Schedule for .NET
  Utilities Solutions Schedule for COM
  Support Policies Staff Scheduler
  Product Life Support Extractor - keyword | keyphrase extraction
  Platform Products
  Contact Us
  all rights reserved  |  copyright  1996 - 2016  |  Terms of Use