vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Schützen Sie Ihre Software vor Software-Piraterie - mit sevLock 1.0 DLL!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Fortgeschrittene
Re: ICONS und DRUCKEN 
Autor: n2004b
Datum: 26.07.04 11:55

Wenn du ein Bild drucken willst, dann kannst du das hier nutzen:

//**************************************
    //     
    // Name: How to print graphics
    // Description:Print graphics
    // By: Kris Bauwens
    //
    //This code is copyrighted and has    // limited warranties.Please see _
      http://
    //     www.Planet-Source-Code.com/vb/scripts/Sh
    //     owCode.asp?txtCodeId=266&lngWId=10    //for details.    _
      //**************************************
    //     
 
    Imports System.Windows.Forms
    Imports System.Drawing.Printing
    Imports System.Drawing
    'Put in a form
    Inherits System.Windows.Forms.Form
    Private m_menu As MainMenu
    Private WithEvents m_doc As New PrintDocument()
    Dim m_printFont As Font = New Font("San Serif", 8)
    Dim m_printBrush As Brush = New SolidBrush(Color.Black)
    Private Sub New()
    MyBase.New()
    CreateMenus()
    End Sub
    Protected Sub CreateMenus()
    Dim mnuFile As MenuItem
    Dim mnuItem As MenuItem
    ' create main menu
    m_menu = New MainMenu()
    ' create file menu
    mnuFile = New MenuItem("File")
    m_menu.MenuItems.Add(mnuFile)
    ' add menu items to file menu
    mnuItem = New MenuItem("Print...", New System.EventHandler(AddressOf Print))
    mnuFile.MenuItems.Add(mnuItem)
    ' set the forms main menu
    Me.Menu = m_menu
    End Sub
    Protected Sub Print(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim dlg As New PrintDialog()
    dlg.Document = m_doc
    If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
    m_doc.Print()
    End If
    End Sub
    Private Sub m_doc_PrintPage(ByVal sender As Object, ByVal e A _
      System.Drawing.Printing.PrintPageEventArgs)Handles m_doc.PrintPage
    Dim xpos, ypos As Single
    Dim lineHeight As Integer
    Dim lineCount As Integer
    Dim msg As String
    msg = "Honey, get me a fork. The darn toaster's jammed!"
    ' get the height of a line of text using the print font for this form
    lineHeight = m_printFont.GetHeight(e.Graphics)
    ' set the starting position at the left and top margins
    ypos = e.MarginBounds.Top
    xpos = e.MarginBounds.Left
    ' draw the string the full length of the page
    While (ypos < e.MarginBounds.Bottom)
    e.Graphics.DrawString(msg, _
    m_printFont, m_printBrush, _
    xpos, ypos)
    ypos = ypos + lineHeight
    End While
    End Sub
    Shared Sub main()
    Application.Run(New Form1())
    End Sub
    Private Sub InitializeComponent()
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(292, 273)
    Me.Name = "Form1"
    End Sub
Ich habe diesen Codeabschnitt von Pscode.com. Ich weiß nicht ob es funtzt. Ich hoffe es.

- Noob -

alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
ICONS und DRUCKEN552GW26.07.04 07:26
Re: ICONS und DRUCKEN314n2004b26.07.04 11:50
Re: ICONS und DRUCKEN333n2004b26.07.04 11:55

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel