A titolo informativo la routine incriminata è questa, in particolare la parte in grassetto:
codice:
Public Sub PaintPicture(image As Variant, Optional cellX As Integer = 0, _
Optional cellY As Integer = 0, Optional cellWidth As Integer = 1, _
Optional cellHeight As Integer = 1, Optional imageWidth As Single = 0, _
Optional imageHeight As Single = 0)
Dim i As Integer
Dim totWidth As Single
Dim totHeight As Single
Dim pictureWidth As Single
Dim pictureHeight As Single
pictureWidth = Printer.ScaleX(image.Width, 8, P_scaleMode)
pictureHeight = Printer.ScaleY(image.Height, 8, P_scaleMode)
For i = 0 To cellWidth - 1
totWidth = totWidth + P_colWidth(cellX + i) + P_drawWidth
Next
totWidth = totWidth - P_drawWidth - 2 * P_internalBorder
For i = 0 To cellHeight - 1
totHeight = totHeight + P_rowHeight(cellY + i) + P_drawWidth
Next
totHeight = totHeight - P_drawWidth - 2 * P_internalBorder
If imageWidth = 0 And imageHeight = 0 Then
If pictureHeight <> totHeight Then
pictureWidth = (pictureWidth * totHeight) / pictureHeight
pictureHeight = totHeight
End If
If pictureWidth > totWidth Then
pictureHeight = (pictureHeight * totWidth) / pictureWidth
pictureWidth = totWidth
End If
Else
pictureWidth = imageWidth
pictureHeight = imageHeight
End If
Call Printer.PaintPicture(image.Picture, _
P_colPos(cellX) + P_drawWidth + P_internalBorder + (totWidth - pictureWidth) / 2, _
P_rowPos(cellY) + P_drawWidth + P_internalBorder + (totHeight - pictureHeight) / 2, _
pictureWidth, _
pictureHeight)
End Sub