Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click
  2. PrintStockListPreview.Document = PrintStockList
  3. PrintStockListPreview.ShowDialog()
  4. End Sub
  5.  
  6.  
  7. Private Sub PrintStockList_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintStockList.PrintPage
  8. Dim x, y, FontHeight As Integer
  9. Dim HeadingFont As New Font("Calibri (body)", 14, FontStyle.Bold)
  10. Dim MyFont As New Font("Courier New", 9, FontStyle.Regular)
  11. Dim PrintStockFormat As String = "{0,-10}{1,-30}{2,-40}{3,-10}{4,-5}{5,-5}"
  12. Dim Printline As String
  13.  
  14. FontHeight = HeadingFont.GetHeight(e.Graphics)
  15.  
  16. x = 300
  17. y = 70
  18. e.Graphics.DrawString("Central Games Stock List", HeadingFont, Brushes.Black, x, y)
  19.  
  20. x = 10
  21. y = y + FontHeight + 20
  22. Printline = ""
  23. e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
  24. FontHeight = MyFont.GetHeight(e.Graphics)
  25.  
  26. y = y + FontHeight + 10
  27. Printline = String.Format(PrintStockFormat, "StockID", "Name", "Description", "Sell For", "Qty", "Done?")
  28. e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
  29.  
  30. y = y + FontHeight + 10
  31.  
  32. FileOpen(1, StockFilename, OpenMode.Random,,, Len(AddStock))
  33. Do While Not EOF(1)
  34. 'Writes each structure to list
  35. FileGet(1, AddStock)
  36. Printline = (String.Format(PrintStockFormat, AddStock.StockID, AddStock.Name, AddStock.Description, AddStock.SellFor, AddStock.Qty, "[]"))
  37. e.Graphics.DrawString(Printline, MyFont, Brushes.Black, x, y)
  38. y = y + FontHeight + 10
  39. Loop
  40. FileClose(1)
  41. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement