|
| |

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 SubIch habe diesen Codeabschnitt von Pscode.com. Ich weiß nicht ob es funtzt. Ich hoffe es.
- Noob - |  |
 | 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 |
  |
|
Neu! sevCommand 4.0 
Professionelle Schaltflächen im modernen Design!
Mit nur wenigen Mausklicks statten auch Sie Ihre Anwendungen ab sofort mit grafischen Schaltflächen im modernen Look & Feel aus (WinXP, Office, Vista oder auch Windows 8), inkl. große Symbolbibliothek. Weitere InfosTipp des Monats Access-Tools Vol.1 
Über 400 MByte Inhalt
Mehr als 250 Access-Beispiele, 25 Add-Ins und ActiveX-Komponenten, 16 VB-Projekt inkl. Source, mehr als 320 Tipps & Tricks für Access und VB
Nur 24,95 EURWeitere Infos
|
| |
|
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
|
|