|
-
Jan 13th, 2003, 01:55 PM
#1
Thread Starter
Addicted Member
Printing multiple Pictureboxes
Can you print more than one picturebox on the same piece of paper? I'm looking to do something like this:
VB Code:
Private Sub cmdPrintPicture_Click()
Printer.PaintPicture Picture1.Image, 0, 0
For i = 5 To 45
If Check1(i).Value = 1 Then
Picture2.Print Check1(i).Caption
End If
Next
Printer.PaintPicture Picture2.Image, 10, 0
Printer.EndDoc
End Sub
Where the first PictureBox prints a graph and the second PictureBox prints the corresponding checkboxes. I know the above code won't work but it should at least give an idea of what I want to do. Thanks
Last edited by run_GMoney; Jan 13th, 2003 at 02:19 PM.
Place Your VBForums Ad Here
-
Jan 13th, 2003, 03:20 PM
#2
Frenzied Member
You don't really need the second Picturebox.
VB Code:
Private Sub cmdPrintPicture_Click()
Printer.PaintPicture Picture1.Image, 0, 0
'adjust Printer.CurrentX/Y - 'set actual number so text will appear under your graph
Printer.CurrentX = 100
Printer.CurrentY = 1000
For i = 5 To 45
If Check1(i).Value = 1 Then
Printer.Print Check1(i).Caption
End If
Next
Printer.EndDoc
End Sub
-
Jan 13th, 2003, 03:34 PM
#3
Thread Starter
Addicted Member
Thanks for that. My next question is can I, instead of using the Check1(i).Caption, print an actual copy of the checkboxes that are checked? I don't even know if that's possible but it would look a lot better. Thanks again for that code though, it works great.
*EDIT: One more thing. Does a PictureBox not AutoSize if text is sent to it? I've set AutoSize = True on a PictureBox and sent some text to it but no Autosizing. Just curious if anyone knew.
Last edited by run_GMoney; Jan 13th, 2003 at 03:40 PM.
Place Your VBForums Ad Here
-
Jan 13th, 2003, 04:07 PM
#4
Frenzied Member
Originally posted by run_GMoney
Thanks for that. My next question is can I, instead of using the Check1(i).Caption, print an actual copy of the checkboxes that are checked? I don't even know if that's possible but it would look a lot better. Thanks again for that code though, it works great.
Everything (well almost) is possible, but in this case it would be total overkill - you need to clip (capture) a particular region, then create a context device, and then ... so, it's not worth it. BTW, (it just came to mind) you may create an image of your Checkbox and print that instead.
*EDIT: One more thing. Does a PictureBox not AutoSize if text is sent to it? I've set AutoSize = True on a PictureBox and sent some text to it but no Autosizing. Just curious if anyone knew.
When you print to a Picturebox you are actually setting its Image and not Picture, therefore Autosize property wont be affected.
-
Jan 13th, 2003, 05:13 PM
#5
Thread Starter
Addicted Member
Originally posted by McGenius
BTW, (it just came to mind) you may create an image of your Checkbox and print that instead.
How would I accomplish something like that?
When you print to a Picturebox you are actually setting its Image and not Picture, therefore Autosize property wont be affected.
Well that's just darn inconvenient. Shouldn't be a huge problem though. Don't s'pose there's any way to alter that is there? I mean, my users can select anywhere from 1 to 40 different rounds so I was hoping to just have the Picturebox Autosize.
Place Your VBForums Ad Here
-
Jan 13th, 2003, 11:33 PM
#6
Frenzied Member
1. At run time press Alt+Print Scrn and paste it onto Paintbrush. Crop your Checkbox and save it as a small bmp file. In your project create an Image control directly on the Picturebox and load that bmp into it. Set cvisible to False. Show it before printing and hide it afterwords. It's an ugly method but it will work at some extent.
2. Not really - that's not what the Picturebox is primarily designed for: displaing images.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|