

' ' Public Sub Printer1_Draw()
' '   
' '     Dim iMarginTop As Integer
' '     Dim iMarginleft As Integer
' '     Dim iMarginRight As Integer
' '     Dim iMarginBottom As Integer
' '     
' ' '-- Take note that the dimensions of the Paint device Printer ( Paint.W and Paint.H ) are based on 72dpi 
' ' '-- Determine margins in pixel
' '     iMarginTop = Printer1.MarginTop / Printer1.PaperHeight * Paint.H
' '     iMarginLeft = Printer1.Marginleft / Printer1.PaperWidth * Paint.W  
' '     iMarginRight = Printer1.MarginRight / Printer1.PaperWidth * Paint.W 
' '     iMarginBottom = Printer1.MarginTop / Printer1.PaperHeight * Paint.H   
' '     
' ' '-- Match diagram rectangle into the target format
' '     If (hImage.W / hImage.H) > (Paint.W / Paint.H) Then 
' '       Paint.DrawImage(hImage, iMarginleft, iMarginTop, Paint.W - iMarginleft - iMarginRight, hImage.H * (Paint.W - iMarginLeft - iMarginRight) / hImage.W) 
' '     Else 
' '       Paint.DrawImage(hImage, iMarginleft, iMarginTop, Paint.W * (Paint.H - iMarginTop - iMarginBottom) / hImage.H, Paint.H - iMarginTop - iMarginBottom) 
' '     Endif
' '     
' ' End 
' '     
' '     Dim fPrintW, fPrintH As Float
' '     Dim fRatioImage As Float
' '       
' '     Paint.Scale(Paint.Width / Printer1.PaperWidth, Paint.Height / Printer1.PaperHeight)
' '     Paint.Translate(Printer1.MarginLeft, Printer1.MarginTop)
' '        
' ' '-- Automatische Umschaltung von Querformat auf Hochformat, wenn Bild.W > Bild.H
' '     'If (hImage.W / hImage.H) > (Paint.W / Paint.H) Then hImage = hImage.Rotate(Pi(0.5))    
' '        
' '     fRatioImage = hImage.W / hImage.H
' '     fPrintW = Printer1.PaperWidth - (Printer1.MarginLeft + Printer1.MarginRight)
' '     fPrintH = fPrintW / fRatioImage
' '     
' ' '-- Match diagram rectangle into the target format
' '     If (hImage.W / hImage.H) > (Paint.W / Paint.H) Then
' '        Paint.DrawImage(hImage, 0, 0, fPrintW, fPrintH)
' '     Else 
' '        'Paint.DrawImage(hImage, iMarginleft, iMarginTop, Paint.W * (Paint.H - iMarginTop - iMarginBottom) / hImage.H, Paint.H - iMarginTop - iMarginBottom) 
' '     Endif
' ' 
' ' End