VisualBasic Problem beim Drucken

T

TomCat911

Gast
Hallo

Ich habe ein Problem mit der Druck Funktion in meinem Programm.
Und zwar hatte ich mein Programm auf einem anderen PC mit WinXP installiert.
Zusätzlich hatte ich den MSI 3.1 und das Framework 3.5 installiert, welche ich von der "VS2008ExpressDEUX1428544.iso" genommen habe. Auf meinem Notebook hatte ich das Visual Basic Express installiert und auf meinem PC Visual C++ Express Edition und das Visual Web Developer Express Edition.

Auf beiden funktioniert das Drucken 1a.
Klick auf Drucken und der Druckauftrag startet sofort.

Auf dem anderen PC, hängt sich das Programm fast auf. Es wird zwar gedruckt nacher langen Zeit, aber man denk da schon fast das Programm wäre abgekackt.
Der rest vom Programm läuft auch ganz gut, z.B. Datei Öffnen und Speichern unter.


In Visual Basic wurde der Druckauftrag wie folgt Programmiert.
Hauptsächlich von der MSDN übernommen.

Code:
    'Drucken
    Dim temp_drucktext As String
    Private Sub cmd_Drucken_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_Drucken.Click
        temp_drucktext = TextBox.Text
        PrintDocument1.Print()
    End Sub

    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim charactersOnPage As Integer = 0
        Dim linesPerPage As Integer = 0

        ' Sets the value of charactersOnPage to the number of characters 
        ' of stringToPrint that will fit within the bounds of the page.
        e.Graphics.MeasureString(temp_drucktext, Me.Font, e.MarginBounds.Size, _
            StringFormat.GenericTypographic, charactersOnPage, linesPerPage)

        ' Draws the string within the bounds of the page
        e.Graphics.DrawString(temp_drucktext, Me.Font, Brushes.Black, _
            e.MarginBounds, StringFormat.GenericTypographic)

        ' Remove the portion of the string that has been printed.
        temp_drucktext = temp_drucktext.Substring(charactersOnPage)

        ' Check to see if more pages are to be printed.
        e.HasMorePages = temp_drucktext.Length > 0


    End Sub

Vielleicht könnt ihr mir da weiterhelfen?
 
Zurück
Oben