"William Cruz" <wc*****@msn.com> schrieb:
I am using a "panel" component as a canvas to draw some graphics. How
can I print what's on the panel component.
\\\
Private Sub Panel1_Paint( _
ByVal sender As Object, _
ByVal e As PaintEventArgs _
) Handles Panel1.Paint
e.Graphics.DrawLine( _
Pens.Red, _
0, 0, _
Me.Panel1.ClientSize.Width, Me.Panel1.ClientSize.Height _
)
e.Graphics.DrawLine( _
Pens.Red, _
0, Me.Panel1.ClientSize.Height, _
Me.Panel1.ClientSize.Width, 0 _
)
End Sub
Private WithEvents m_PrintDocument As PrintDocument
Private Sub ButtonPrint_Click(...) Handles Button1.Click
m_PrintDocument = New PrintDocument
m_PrintDocument.Print()
End Sub
Private Sub m_PrintDocument_PrintPage( _
ByVal sender As Object, _
ByVal e As PrintPageEventArgs _
) Handles m_PrintDocument.PrintPage
Dim mi As MethodInfo = _
Me.Panel1.GetType().GetMethod( _
"OnPaint", _
BindingFlags.Instance Or BindingFlags.NonPublic _
)
mi.Invoke( _
Me.Panel1, _
New Object() { _
New PaintEventArgs(e.Graphics, New Rectangle(0, 0, 0, 0)) _
} _
)
End Sub
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>