Hi,
I’m trying to print out images that are connected with a block of text for some database records, and I’m having a hard time scaling the images so they will scale down and print out at a proportional size. The code I have is the following:
[code]…Code
g.DrawString(s, X, Y, 726.5)
Y= Y+ g.StringHeight(s, 726.5)+ g.TextHeight
g.DrawString("A) "+frmMain.txtA.text, X, Y, 726.5)
Y=Y+ g.StringHeight("A) "+frmMain.txtA.text, 726.5)
g.DrawString("B) "+frmMain.txtB.text, X, Y, 726.5)
Y= Y+ g.StringHeight("B) "+frmMain.txtB.text, 726.5)
g.DrawString("C) "+ frmMain.txtC.text, X, Y, 726.5)
Y= Y+ g.StringHeight("C) "+frmMain.txtC.text, 726.5)
g.DrawString("D) "+ frmMain.txtD.text, X, Y, 726.5)
Y= Y+ g.StringHeight("D) "+frmMain.txtD.Text, 726.5)+ g.TextHeight
If frmMain.txtImage.Text <> "" Then
g.DrawPicture pic,X,Y,90,60,0,0, pic.width, pic.height
Y = Y + pic.Height + g.TextHeight + g.TextHeight + g.TextHeight
End If[/code]
The problem is with this line of code:
g.DrawPicture pic,X,Y,90,60,0,0, pic.width, pic.height
The problem with the code is that it simply scales the image to 90, 60. So if the customer’s image is not set up to a 6 x 9 format it will appear distorted. The customer’s images can be landscape or portrait and all different sizes. I want the images to print out smaller so they fit well with the text, but also look proportionally correct.
How can I write the code so that the pictures print out smaller than the original but proportionally in about the size of 90 x 60? Any help would be appreciated.