Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net & .Net Compact Framework
 SPC Control Chart Tools for .Net
 chart print question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Alice

25 Posts

Posted - 31 Jul 2008 :  15:54:14  Show Profile  Reply with Quote
I have 20 sets of data with data format set to 9.9999. If I display all these datasets(20 columns) in one page, there will be over lap between each columns. So I just enable scrollbar and display only 10 on each page, the scrollbar will let the other group show.

My question is when I print out my chart, it only prints one scroll page(the current data on screen) at a time, then scroll to next page to print another page. How can I print all pages by one print command?

I use this code to print:

Public Sub PrintPage(ByVal charview As ChartView, ByVal sender As Object, ByVal e As System.EventArgs)
If Not (charview Is Nothing) Then
If printobj Is Nothing Then
If printobj Is Nothing Then
printobj = New ChartPrint(charview)
printobj.DoPrintDialog()
Else
printobj.PrintChartView = charview
End If
End If
printobj.DocPrintPage(sender, e)
End If
End Sub

quinncurtis

1164 Posts

Posted - 31 Jul 2008 :  17:32:57  Show Profile  Reply with Quote
You can position the chart starting position using the HScrollBar1 property. So basically you advance the scrollbar by the number of records you display per page. You can use code similar to that below.

' This routine prints a chart by invoking the chart objects DocPrintPage method
    Public Sub PrintPage(ByVal charview As ChartView, ByVal sender As Object, ByVal e As System.EventArgs)
        If Not (charview Is Nothing) Then
            If printobj Is Nothing Then
                printobj = New ChartPrint(charview)
                printobj.DoPrintDialog()
            Else
                printobj.PrintChartView = charview
            End If
' SO INSTEAD OF CALLING the FOLLOWING LINE
            ' printobj.DocPrintPage(sender, e)

' USE THE HScrollBar1.Value PROPERTY TO ADVANCE THE CHART A PAGE AT A TIME
            Dim i As Integer
            Dim spcchart As SPCChartBase = charview
            For i = 0 To spcchart.ChartData.CurrentNumberRecords - 1 Step spcchart.ChartData.NumRecordsPerChart
                spcchart.HScrollBar1.Value = i
                spcchart.RebuildChartUsingCurrentData()
                printobj.DocPrintPage(sender, e)
            Next
        End If
    End Sub 'PrintPage



Similar code for C#

public void PrintPage(ChartView charview, object sender, System.EventArgs e)
{
  if (charview != null)
  {
    if (printobj == null)
    {
	printobj = new ChartPrint(charview);
	printobj.DoPrintDialog();
    }
    else
	printobj.PrintChartView = charview;

    SPCChartBase spc = (SPCChartBase)charview;
    for (int i = 0; i < spc.ChartData.CurrentNumberRecords; i += spc.ChartData.NumRecordsPerChart)
    {
       spc.HScrollBar1.Value = i;
       spc.RebuildChartUsingCurrentData();
       printobj.DocPrintPage(sender, e);
    }
}

}
Go to Top of Page

Alice

25 Posts

Posted - 01 Aug 2008 :  11:39:16  Show Profile  Reply with Quote
Thanks. That works!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07