Hallo
So nach langem tüfteln bin ich soweit gekommen. Es wird zwar immer als letztes ein leerBlatt ausgegeben aber das ist noch verschmerzbar![;)](https://www.vb-paradise.de/wcf/images/smilies/wink.png)
Spoiler anzeigen
So nach langem tüfteln bin ich soweit gekommen. Es wird zwar immer als letztes ein leerBlatt ausgegeben aber das ist noch verschmerzbar
![;)](https://www.vb-paradise.de/wcf/images/smilies/wink.png)
VB.NET-Quellcode
- Private Sub PrintChart(sender As Object, e As Printing.PrintPageEventArgs)
- ' Initialize variables
- Static currentPageIndex As Integer = 0
- Dim yPos As Single = e.MarginBounds.Top
- Dim chartWidth As Integer = CInt(e.PageSettings.PrintableArea.Width)
- Dim chartHeight As Integer = CInt(chartWidth * 0.75 / 2)
- Dim chartsPerPage As Integer = 2
- Dim chartIndex As Integer = 0
- For i As Integer = currentPageIndex To cmb_Wettertyp.Items.Count - 1 Step 1
- ' Set the selected item in the ComboBox
- cmb_Wettertyp.SelectedIndex = i
- ' Draw the chart
- Using chartImage As New Bitmap(Chart1.Width, Chart1.Height)
- Chart1.DrawToBitmap(chartImage, New Rectangle(0, 0, Chart1.Width, Chart1.Height))
- e.Graphics.DrawImage(chartImage, e.MarginBounds.Left, yPos, chartWidth, chartHeight)
- chartIndex += 1
- If chartIndex Mod 2 = 0 Then
- yPos += chartHeight
- If chartIndex < cmb_Wettertyp.Items.Count Then
- e.HasMorePages = True
- currentPageIndex = i + 1
- Exit Sub
- End If
- Else
- yPos += chartHeight
- End If
- End Using
- Next
- ' Reset the page index
- currentPageIndex = 0
- End Sub
Asperger Autistin. Brauche immer etwas um gewisse Sachen zu verstehen. ![:huh:](https://www.vb-paradise.de/wcf/images/smilies/huh.png)
![:huh:](https://www.vb-paradise.de/wcf/images/smilies/huh.png)