Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click
- PrintStockListPreview.Document = PrintStockList
- PrintStockListPreview.ShowDialog()
- End Sub
- Private Sub PrintStockList_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintStockList.PrintPage
- Dim x, y, FontHeight As Integer
- Dim HeadingFont As New Font("Calibri (body)", 14, FontStyle.Bold)
- Dim MyFont As New Font("Courier New", 9, FontStyle.Regular)
- Dim PrintStockFormat As String = "{0,-10}{1,-30}{2,-40}{3,-10}{4,-5}{5,-5}"
- Dim Printline As String
- FontHeight = HeadingFont.GetHeight(e.Graphics)
- x = 300
- y = 70
- e.Graphics.DrawString("Central Games Stock List", HeadingFont, Brushes.Black, x, y)
- x = 10
- y = y + FontHeight + 20
- Printline = ""
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- FontHeight = MyFont.GetHeight(e.Graphics)
- y = y + FontHeight + 10
- Printline = String.Format(PrintStockFormat, "StockID", "Name", "Description", "Sell For", "Qty", "Done?")
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- y = y + FontHeight + 10
- FileOpen(1, StockFilename, OpenMode.Random,,, Len(AddStock))
- Do While Not EOF(1)
- 'Writes each structure to list
- FileGet(1, AddStock)
- Printline = (String.Format(PrintStockFormat, AddStock.StockID, AddStock.Name, AddStock.Description, AddStock.SellFor, AddStock.Qty, "[]"))
- e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
- y = y + FontHeight + 10
- Loop
- FileClose(1)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement