Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PrintForm not print out  the .ocx controls.

Posted on 1998-12-12
5
Medium Priority
?
209 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 200 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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

877 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