?
Solved

print the contents of the picture control

Posted on 2003-02-25
7
Medium Priority
?
179 Views
Last Modified: 2010-05-01
i have one form, i put on this form a picture control and use some code to draw some things on this picture control.
now i want to print the contents of this picture control. how can i do that? and also i want to the drawing to fit the paper i print on
0
Comment
Question by:aft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:sanjaykattimani
ID: 8015852
SavePicture  Picture1.Picture "filename.bmp"
0
 
LVL 3

Expert Comment

by:sanjaykattimani
ID: 8015887
oops... here is something to print it.
in it simplest form (withought adjustments)
Printer.PaintPicture pBox.Picture
Private Sub PrintPictureBox(pBox As PictureBox, _
                           Optional ScaleToFit As Boolean = True, _
                           Optional MaintainRatio As Boolean = True)
 
 Dim xmin As Single
 Dim ymin As Single
 Dim wid As Single
 Dim Hgt As Single
 Dim aspect As Single
 
    Screen.MousePointer = vbHourglass
   
    If Not ScaleToFit Then
        wid = Printer.ScaleX(pBox.ScaleWidth, pBox.ScaleMode, Printer.ScaleMode)
        Hgt = Printer.ScaleY(pBox.ScaleHeight, pBox.ScaleMode, Printer.ScaleMode)
        xmin = (Printer.ScaleWidth - wid) / 2
        ymin = (Printer.ScaleHeight - Hgt) / 2
    Else
        aspect = pBox.ScaleHeight / pBox.ScaleWidth
        wid = Printer.ScaleWidth
        Hgt = Printer.ScaleHeight
       
        If MaintainRatio Then
            If Hgt / wid > aspect Then
                Hgt = aspect * wid
                xmin = Printer.ScaleLeft
                ymin = (Printer.ScaleHeight - Hgt) / 2
            Else
                wid = Hgt / aspect
                xmin = (Printer.ScaleWidth - wid) / 2
                ymin = Printer.ScaleTop
            End If
        End If
    End If
   
    Printer.PaintPicture pBox.Picture, xmin, ymin, wid, Hgt
    Printer.EndDoc

    Screen.MousePointer = vbDefault

End Sub

complete application is available in http://www.Planet-Source-Code.com/vb 
at

http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=37488&lngWId=1
0
 

Author Comment

by:aft
ID: 8016095
but this will print on the default printer. how can i change the printer? i know how to display the printing common dialog but how can get the value of the printer and pass it to ur code?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:aft
ID: 8047371
and also the problem is in the paintpicture because the first argument must be a photo but what i have in my picture box is not a photo. it is just some lines and shapes. so how can i print them? should i convert them first to a picture? how?
0
 

Expert Comment

by:CleanupPing
ID: 8901162
aft:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8972742
aft, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9667959
PAQed - no points refunded (of 25)

Computer101
E-E Admin
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question