Skip to content

PrintCalendar Method

Description

Prints the current Calendar view.

Syntax

Public Sub PrintCalendar( _
    ByVal [lHDC](#) As Integer _
)

Parameters

  • lHDC
    A device context for a Printer object.
    Use 0 to let the CalendarControl auto-detect printer settings and display a dialog for printing.
    With a CommonDialog control, the CommonDialog.hDC property returns a device context for the printer selected in the Print dialog box when the cdlReturnDC flag is set. See the sample below for more on how to do this.

Remarks

A call to PrintCalendar will send the current Calendar View directly to the printer.

The PrintOptions property can be used to customize how the Calendar View is printed when PrintCalendar is called. With PrintOptions, you can change the page margins, header font, and several other options.

The ShowPrintPageSetup method displays a custom "Page Setup" print dialog for the Calendar. The ShowPrintPageSetup dialog allows users to change all the properties of the PrintOptions object. All settings are stored in the PrintOptions object. When PrintCalendar is called, it will use the settings in PrintOptions.

Example

Printing the current Calendar View (Visual Basic)

This sample illustrates how to print the current Calendar View.

' Printing using the default printer dialog  
wndCalendarControl.PrintCalendar 0  

' Printing using the CommonDialog Control  
On Error Resume Next  

With dlgCommonDialog  
    .DialogTitle = "Print"  
    .CancelError = True  
    .Flags = cdlPDReturnDC + cdlPDNoPageNums  
    .ShowPrinter  
    If Err <> MSComDlg.cdlCancel Then  
        wndCalendarControl.PrintCalendar .hDC  
    End If  
End With  

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.