Solved

PrintForm not print out  the .ocx controls.

Posted on 1998-12-12
5
203 Views
Last Modified: 2010-05-03
I tried PrintForm but con not print out the .cox controls in the form, only the standard controls were printed out.

Any thing wrong I did? How to print the .cox controls as well?

Cheers.

Learn
0
Comment
Question by:learn
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
Sendoh earned 50 total points
ID: 1449720
Hi !

you may try create a picturebox and set the visible to false.
then write the following code:

Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source

Private Declare Function BitBlt Lib "gdi32" _
    (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, _
    ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
    ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

Private Sub Command1_Click()
    Picture1.Width = Form1.Width
    Picture1.Height = Form1.Height
    BitBlt Picture1.hDC, 0, 0, Form1.Width, Form1.Height, _
            Form1.hDC, 0, 0, SRCCOPY
    Printer.PaintPicture Picture1.Image, 0, 0
End Sub

0
 

Author Comment

by:learn
ID: 1449721
Hi Sendoh

You again :-)

OK, I will try what you suggested.
Do you believe VB can not print out the .ocx controls in a form by PrinForm?

Cheers.

Learn
0
 
LVL 3

Expert Comment

by:Sendoh
ID: 1449722
Yes !! I'd tried it out already.
Somehow it just can't printout the custom ocx control.
I've got some addition comment, If you need to print the form border as well, then you had to
       parentHwnd = getParent(form1.hwnd)
       parentDC = getDC(parentDC)
       BitBlt picture1.hdc, 0, 0, Form1.Width, _
               Form1.Height, parentDC, startX, startY, SRCCOPY

Note: startX and startY are the screen coordinate for form1.
0
 

Author Comment

by:learn
ID: 1449723
Hi Sendoh

Thank you for your added comment.

>Yes !! I'd tried it out already.

My English is not very good :-) When you say "Yes", do you mean "PrintForm can not print the .ocx controls in the printer"?

Happy Xmas.

Learn
0
 
LVL 3

Expert Comment

by:Sendoh
ID: 1449724
Yeap ! I think so.
I think there is some reason behind. Who knows ??
BTW,
Merry Christmas !! ^_^
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 / DAO 3.6 / run time error: Couldn't find installable ISAM 7 103
Reading the Contents of a Directory In Access VBA 5 77
MsgBox 2 59
Access 2013 combo box not working 3 51
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

828 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