Rank: Member
Groups: Guest
Joined: 8/30/2005(UTC) Posts: 5
|
Hi all, I have been having so much trouble with printing a simple image on a sheet of paper in a specific location, my hair is falling out. I searched here and found that many were having printing issues as well. I tried many of the solutions and still continued to have problems. Then I fell upon an awsome discovery. Here was my problem. (VB 6.0) 1. The page size that i needed to use was 9.5" X 7.125" which as you can see is a custom size 2. I needed to print 2 images in a specific location landscape. 3. It was no problem setting my printer to handle the custom size and it appeared to be simple. 4. I made a form the same size as my printer.object width,height,scalewidth,scaleheight and made sure that it was the same scalemode. 5. I put 2 picture boxes on the form. positioned them and removed the border and called the form.printform method. 6. It worked great but i had forgotten to make the form a white background. 7. When I made the form1.background white, and printed it (printform) the pictures moved all the way to the left side of the page. No matter what x,y coords i gave it, it continued to print far left. When I made the form.back grey again, it worked fine. I fought with this for a couple days and came up with no solution. Today i discovered the solution by accident. Instead of using the picture control, I tried the image control and it worked great even with the form.back white. The only reason I can figure is that, as you probably know the image control has no Hdc property where the Picture control does. So if you are having problems printing a picture on a form in a specific location, try loading the image into an image control, placing it on the form using the move method, removing the border and then printing using the printform method Here is some code i use for moving the image around on the screen with the arrow keys before i call printform Code: 'The forms key preview is set to true
'chng is a text box to enter the increments to move
'x1 is a textbox for the x coords for pic 1
'y1 is a textbox for the y coords for pic 1
' remember to make all the controls invisible before calling printform
INC = CLng(chng) ' the incremants in the change
Select Case KeyCode
Case 37 ' move it left
X1 = CInt(X1) - INC: DoEvents
prntfrm.Cls
DoEvents
'prntfrm.PaintPicture Clipboard.GetData, CInt(X1), CInt(Y1)
'The above can be used if the image is in the clipboard remember form1.cls after a change
pic.Move X1, Y1
Case 40 ' movce it down
Y1 = CInt(Y1) + INC: DoEvents
prntfrm.Cls
DoEvents
'prntfrm.PaintPicture Clipboard.GetData, CInt(X1), CInt(Y1)
pic.Move X1, Y1
Case 38 ' move it up
Y1 = CInt(Y1) - INC: DoEvents
prntfrm.Cls
DoEvents
'prntfrm.PaintPicture Clipboard.GetData, CInt(X1), CInt(Y1)
pic.Move X1, Y1
Case 39 'move it down
X1 = CInt(X1) + INC: DoEvents
prntfrm.Cls
DoEvents
'prntfrm.PaintPicture Clipboard.GetData, CInt(X1), CInt(Y1)
pic.Move X1, Y1
End Select
I then save the coords in the win registry so that they are there the next time the program runs without re-designating them. Code:SaveSetting "PhotoProcessor", "Coords", "pic1x", X1.Text
SaveSetting "PhotoProcessor", "Coords", "pic1y", Y1.Text
SaveSetting "PhotoProcessor", "Coords", "pic2x", X2.Text
SaveSetting "PhotoProcessor", "Coords", "pic2y", Y2.Text
I hope this help someone.. Ira iwhitney@iwdata.comprinting images,printer,printform Edited by user Sunday, December 23, 2007 4:55:56 PM(UTC)
| Reason: Not specified
|