I'm with today's 3.15.90 / gb.gui.qt and your code crashes gambas completely ...
Thanks for trying.
Maybe it (Preview method) is hanging up expecting something to be defined that wasn't yet.
Thanks, but I can't work out what.
Charlie here is an example that I use in my File Cabinet program that does work.....
Thanks. I have managed to get the print routine working, I just wanted to try the preview.
The program prints on 1" (25.4mm) x 2" (50.8mm) labels. The main problem is that after 1 print of say 5 labels, the next print only prints 1, even though the 'No of copies' is set to 5.
If you want to see how the 'Preview' works just press [Ctrl] + P in the IDE.
The actual code I am using is: -
Public Sub PrintButtons_Click()
iPrint = Last.Tag
Printer1.PaperHeight = 25.4
Printer1.PaperWidth = 50.8
Printer1.MarginBottom = 0
Printer1.MarginTop = 0
Printer1.MarginLeft = 0
Printer1.MarginRight = 0
Printer1.Orientation = Printer.Portrait
If Printer1.Configure() Then Return
Public Sub Printer1_Draw()
Dim hCode As Label = [LabelCodeSO, LabelCode]
Dim hLabels As Label = [LabelNoSO, LabelTitle]
Dim hBrush As PaintBrush
Dim sFont1Size As String = Settings["barcode/size1", "40"]
Dim sFont2Size As String = Settings["barcode/size2", "16"]
Dim sFont1 As String = "code128," & sFont1Size
Dim sFont2 As String = "freeserif,Bold," & sFont2Size
Dim iY1 As Integer = Settings["barcode/y1", 0]
Dim iY2 As Integer = Settings["barcode/y2", 25]
hBrush = Paint.Color(Color.Black)
Paint.Font = Font[sFont1]
Paint.DrawText(hCode[iPrint].Text, 0, iY1, 105, 20, Align.Center)
Paint.Font = Font[sFont2]
Paint.DrawText(hLabels[iPrint].Text, 0, iY2, 105, 20, Align.Center)
This is the output