Solved

PrintForm not print out  the .ocx controls.

Posted on 1998-12-12
5
199 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now