|
Tipp 0153
|
PrintForm-Komponente
|
|
|
Autor/Einsender: Datum: |
|
Michael Werner 29.12.2006 |
|
Entwicklungsumgebung: |
|
VB.Net 2005 |
Framework: |
|
2.0 |
|
|
Microsoft zeigt sich einsichtig: Es gibt einen Ersatz für die Methode PrintForm aus VB6-Zeiten, ein Powerpack-AddOn mit dem Namen
PrintForm Component 1.0.
|
Mit der Komponente wird das Ausdrucken einer Form wieder ein Kinderspiel. Die Komponente muss nach dem Download installiert werden und kann dann
der Toolbox hinzugefügt werden:
|
- Rechtsklick in der Toolbox auf Drucken
- Element auswählen
- in der .NET-Komponentenliste PrintForm auswählen
- wie gewohnt eine Instanz von PrintForm auf die Form ziehen.
|
Mit der Eigenschaft PrintAction kann dann ausgewählt werden, ob direkt gedruckt oder eine Vorschau dazwischengeschaltet werden soll.
Schließlich gibt es noch die Möglichkeit zum Drucken in eine eps-Datei. Das eps-Format Encapsulated Postscript (EPS) ist eine Datei in der
Seitenbeschreibungssprache PostScript.
|
|
|
Private Sub btnPrint_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnPrint.Click
If RadioButton1.Checked = True Then
'Form drucken mit Preview
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
ElseIf RadioButton2.Checked = True Then
'Form drucken
PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter
Else
'Form in eps-File (Postscript) drucken
PrintForm1.PrintFileName = "c:\printform_test.eps"
PrintForm1.PrintAction = Printing.PrintAction.PrintToFile
End If
PrintForm1.Print()
End Sub
|
|
|
|
|
Windows-Version |
98/SE |
|
|
ME |
|
|
NT |
|
|
2000 |
|
|
XP |
|
|
Vista |
|
|
Win
7 |
|
|
|
|
Download (18,2 kB)
|
Downloads bisher: [ 456 ]
|
|
|