Previedol som úpravu - už mi reaguje na zmenu orientácie ale nemení zdroj-zásobnk papiera. Bude to asi tlačiarňou "LEXMARK E250 d". Previedol som následujúci test pre rôzne zdroje papiera
txt.Text &= "Zdroj " & PrintDocument1.PrinterSettings.DefaultPageSettings.PaperSource.SourceName & vbCrLf
txt.Text &= "Zdroj " & PrintDocument1.PrinterSettings.DefaultPageSettings.PaperSource.Kind & vbCrLf
Hodnota "Kind" stále = 257 Veľmi pekne ďakujem za navigáciu a prikladám úpravu
Imports system.drawing.printing
Public Class Form1
Public prDoc As New PrintDocument
Public pgTržba, pgVstup As New PageSettings
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
pgVstup.Landscape = True
pgVstup.PaperSource.SourceName = "Manual paper"
pgTržba.Landscape = True
pgTržba.PaperSource.SourceName = "Tray 1"
End Sub
Private Sub btnVstup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVstup.Click
Try
AddHandler prDoc.PrintPage, AddressOf Me.TlačVstup
prDoc.DefaultPageSettings = pgVstup
prDoc.Print()
Catch ex As Exception
MessageBox.Show("Problém s tlačou", ex.ToString)
End Try
End Sub
Private Sub TlačVstup(ByVal sender As System.Object, ByVal ev As PrintPageEventArgs)
ev.Graphics.DrawString(txt1.Text, New Font("Courier New", 10, FontStyle.Regular), Brushes.Black, 400, 2)
ev.Graphics.DrawString(txt2.Text, New Font("Courier New", 14, FontStyle.Bold), Brushes.Black, 580, 156)
ev.HasMorePages = False
End Sub
Private Sub btnTržba_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTržba.Click
Try
AddHandler prDoc.PrintPage, AddressOf Me.TlačTržby
prDoc.DefaultPageSettings = pgTržba
prDoc.Print()
Catch ex As Exception
MessageBox.Show("Problém s tlačou", ex.ToString)
End Try
End Sub
Private Sub TlačTržby(ByVal sender As System.Object, ByVal ev As PrintPageEventArgs)
ev.Graphics.DrawString(TB8.Text, New Font("Courier New", 10, FontStyle.Regular), Brushes.Black, 0, 0)
ev.HasMorePages = False
End Sub
End Class
Ešte raz ďakujem
|