Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Printing a PictureBox


Reply
 
Thread Tools Display Modes
  #1  
Old 04-18-2003, 10:23 AM
MindGenius MindGenius is offline
Banned
 
Join Date: Sep 2003
Location: London, United Kingdom
Posts: 392
Cool Printing a PictureBox


I've got a picturebox, and I've got some code in it so that you can draw lines during runtime, therefore creating a picture. Is there a way to print the contents of the picturebox?
I've set the Printer.CurrentX and the Printer.CurrentY values, and I've tried
Code:
Printer.Print Picture1.Picture

What do I do?
Reply With Quote
  #2  
Old 04-18-2003, 10:28 AM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

Picture1.PaintPicture Picture1.Image
Reply With Quote
  #3  
Old 04-18-2003, 10:30 AM
MindGenius MindGenius is offline
Banned
 
Join Date: Sep 2003
Location: London, United Kingdom
Posts: 392
Default

Where do I put that?
Reply With Quote
  #4  
Old 04-18-2003, 10:33 AM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

where you had Printer.Print Picture1.Picture..........
Reply With Quote
  #5  
Old 04-18-2003, 10:35 AM
MindGenius MindGenius is offline
Banned
 
Join Date: Sep 2003
Location: London, United Kingdom
Posts: 392
Default

It says that PaintPicture isn't a proper argument...
Reply With Quote
  #6  
Old 04-18-2003, 10:45 AM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

OOPS! I typed it wrong, sorry.

Printer.PaintPicture Picture1.Image
Reply With Quote
  #7  
Old 04-18-2003, 12:50 PM
MindGenius MindGenius is offline
Banned
 
Join Date: Sep 2003
Location: London, United Kingdom
Posts: 392
Default

Still the same error...
Reply With Quote
  #8  
Old 04-18-2003, 01:00 PM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

Works for me.
Reply With Quote
  #9  
Old 04-19-2003, 02:13 AM
MindGenius MindGenius is offline
Banned
 
Join Date: Sep 2003
Location: London, United Kingdom
Posts: 392
Default

What do I need to define B4hand?
I've got:
Code:
Private Sub mnuFilePrint_Click() Printer.CurrentX = 100 Printer.CurrentY = 100 Printer.PaintPicture picDraw.Image Printer.EndDoc End Sub
Anything more?
Reply With Quote
  #10  
Old 04-19-2003, 02:23 AM
sjp's Avatar
sjp sjp is offline
Junior Contributor
 
Join Date: Jan 2003
Posts: 257
Default

what abt this.....

Printer.PaintPicture Picture1.Image, 0, 0
Reply With Quote
  #11  
Old 04-19-2003, 02:40 AM
MindGenius MindGenius is offline
Banned
 
Join Date: Sep 2003
Location: London, United Kingdom
Posts: 392
Default

The printer prints out a light grey square the size of the picbox! I've got this code to daw inside:
Code:
Private Sub picDraw_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then picDraw.DrawMode = vbXorPen StartX = X StartY = Y OldX = 0 OldY = 0 End If End Sub Private Sub picDraw_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then If OldX Or OldY Then picDraw.Line (StartX, StartY)-(OldX, OldY) picDraw.Line (StartX, StartY)-(X, Y) OldX = X OldY = Y End If End Sub Private Sub picDraw_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = vbLeftButton Then picDraw.DrawMode = vbCopyPen picDraw.Line (StartX, StartY)-(X, Y) End If End Sub
Reply With Quote
  #12  
Old 04-19-2003, 08:08 AM
sjp's Avatar
sjp sjp is offline
Junior Contributor
 
Join Date: Jan 2003
Posts: 257
Default

set these two properties for the pciture box.

picDraw.redraw = true
set picDraw. back color to white
Reply With Quote
  #13  
Old 04-19-2003, 02:24 PM
MindGenius MindGenius is offline
Banned
 
Join Date: Sep 2003
Location: London, United Kingdom
Posts: 392
Default

Thanks, it works!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing to a picturebox bwspangler General 4 10-09-2002 07:10 AM
Printing a picturebox alp0001 General 4 07-19-2002 10:15 AM
printing to a picturebox rozner9124 General 1 06-06-2002 02:46 PM
Printing Text in Picturebox - Poor Resolution byrne1 General 6 02-26-2002 10:23 AM
printing a picturebox dragnut General 4 07-12-2001 09:29 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->