Torna al Thread

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ppd As New PrintPreviewDialog Dim ps As New PaperSize("Scontrino", 224, 254) Dim pps As New PrinterSettings pps.DefaultPageSettings.PaperSize = ps PrintDocument1.DefaultPageSettings.PaperSize = ps ppd.Document = PrintDocument1 ppd.Name = "Anteprima scontrino" ppd.Document.DefaultPageSettings.PaperSize = ps ppd.ShowDialog() End Sub Private Sub PrintDocument1_PrintPage_1(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim myString As String = "*** INTESTAZIONE ***" Dim myFont As New Font("Arial", 10, FontStyle.Bold) Dim stringSize As New SizeF stringSize = e.Graphics.MeasureString(myString, myFont) Dim layout_rect As New Rectangle(e.PageBounds.Location, e.PageBounds.Size) e.Graphics.DrawRectangle(Pens.Green, Rectangle.Round(layout_rect)) Dim string_format As New StringFormat string_format.Alignment = StringAlignment.Center e.Graphics.DrawString(myString, myFont, Brushes.Black, e.PageBounds.Size.Width / 2, 30, string_format) myString = "ALLINEATO A SX" string_format.Alignment = StringAlignment.Near e.Graphics.DrawString(myString, myFont, Brushes.Black, e.PageBounds.X, 45, string_format) myString = "ALLINEATO A DX" string_format.Alignment = StringAlignment.Far e.Graphics.DrawString(myString, myFont, Brushes.Black, e.PageBounds.Width, 60, string_format) End Sub
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5