i want to print a rectangle on a page. i have this code:
---------------- ' Gambas class file Private Const PAPER_FACTOR As Float = 7.55 Public Sub btnPrint_Click() If prtPrinter.Configure() Then Return Me.Enabled = False Inc Application.Busy prtPrinter.Print Dec Application.Busy Me.Enabled = True End Public Sub prtPrinter_Draw() Dim X As Float Dim Y As Float Dim W As Float Dim H As Float Dim wFactor As Float Dim hFactor As Float txtArea.Text &= "Begin Draw\n" 'Set scale wFactor = prtPrinter.PaperWidth / Paint.Width hFactor = prtPrinter.PaperHeight / Paint.Height Paint.Scale(wFactor, hFactor) 'Set Color to red Paint.Color(Color.RGB(255, 0, 0, 0)) 'Set X,Y margin to 0,0 X = 0 Y = 0 'W points * 7.55 = W mm 'W = 100 = 100 mm = 10 cm W = 200 * PAPER_FACTOR H = 100 * PAPER_FACTOR 'Draw a rectangle Paint.Rectangle(X, Y, W, H) 'Write it on paper Paint.Stroke End ------------------ At the beginning i make a scale Paint.Scale(wFactor, hFactor) according to page http://gambasdoc.org/help/howto/print?v3 to have absolute coordinates. Problem #1 ----------- i want the rectangle to be printed at (x,y) = (0,0) so i set 'Set X,Y margin to 0,0 X = 0 Y = 0 But at the page it is printed 46 points inside and lower. If i use X = -46 Y = -46 i get the rectangle at the beginning of page, straight to border. Problem #2 ----------- i want to set width to 100 millimeters. I found that i have to multiply the number in millimeters with 7.55 so i use this as constant PAPER_FACTOR How really does this work? why this number? Problem #3 ----------- 'Set Color to red Paint.Color(Color.RGB(255, 0, 0, 0)) color does not work on printing i get black lines -- Regards, Demosthenes Koptsis. ------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user