Skip to content

PrintChart Method

Description

Prints the current chart view.

Syntax

Public Sub PrintChart( _
    ByVal lHDC As Integer _
)

Parameters

  • lHDC: A device context for a Printer object. Use 0 to let the Chart Control auto-detect printer settings and display a dialog for printing.

Remarks

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.

This can be used to print with the command bars print preview if available.

Example

This sample illustrates how to print the current chart.

' Printing using the default printer dialog  
wndChartControl.PrintChart 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  
        wndChartControl.PrintChart .hDC  
    End If  
End With  

See Also

ChartControl Control


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