 |
 |

06-04-2003, 10:52 PM
|
|
Regular
|
|
Join Date: Apr 2003
Location: Singapore
Posts: 61
|
|
How to print images that fit to the page size specified in Print Common Dialog?
|
i need some help in printing the whole image tat fit onto the paper size i specified in Print Common Dialog. I hav a PictureBox array & each PictureBox contains a smaller Picturebox inside. For example : Picture1(index) has a smaller Picture2(index) inside. There are vertical & horizontal scrollbars next to each Picture1(index).
i already hav the basic Print Common Dialog code below. Here's the problem -> I can print out the pictures displayed inside Picture2(index) but the printout will turn out truncated or just part of the whole picture when im printing to a 4R photo size for example and the image displayed in Picture2(index) is larger then the bounding Picture1(index) & i need to use the scrollbars to scroll and view the other portions of the image.
So how to modify the code below to print out the whole image tat fit nicely to the paper size i specified. Thanxs.
'---------------------------------------------------------------------
'CODE
'---------------------------------------------------------------------
CommonDialog1.CancelError = True
On Error Resume Next
CommonDialog1.Action = 5 ' Start the Print Common Dialog
If (Err.Number = cdlCancel) Then Exit Sub
'when Cancel is pressed, exit subroutine
'Code to print the array here
For Pics = Picture2.LBound To Picture2.UBound
If Picture2(Pics).Picture > 0 Then ' If the PictureBox is not empty
Printer.PaintPicture Picture2(Pics).Picture, 0, 0
Printer.EndDoc
End If
Next
'---------------------------------------------------------------------
|
|

06-05-2003, 12:05 AM
|
 |
Junior Contributor
|
|
Join Date: Jan 2003
Posts: 257
|
|
|
the paintpicture method has these parameters. so u can specify them to have ur pic printed int he size u want. so if u specify teh destination width and height too, which is ur paper size, it might give u the desired result.
Printer.PaintPicture Picture2(Pics).Picture, DestX, DestY, DestWidth, DestHeight, SourceX, SourceY, SourceWidth, SourceHeight
|
Last edited by sjp; 06-05-2003 at 01:30 AM.
|

06-05-2003, 12:21 AM
|
|
Regular
|
|
Join Date: Apr 2003
Location: Singapore
Posts: 61
|
|
Quote: Originally Posted by sjp the paintpicture method has these parameters. so u can specify them to have ur pic printed int he size u want. so if u specify teh destination width and height too, which is ur paper size, it might give u the desired result.
Printer.PaintPicture Picture2(Pics).Picture, DestX, DestY, DestWidth, DestHeight, SourceX, SourceY, SourceWidth, SourceHeight, RasterOp
Hey....thanxs SJP. i will try adding the DestWidth & DestHeight.
Btw, regarding the printing multiple pages of the same image thread which u helped me the other time, i thik i manage to solve the bug which always send a new page to print even though i added a "IF" statement to stop it if the condition fails. i modified yur code alittle & now the "IF" statement works correctly together wif the "Printer.NewPage". Thanxs for yur advice. 
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|