-
Aug 25th, 2010, 01:57 PM
#1
Dpi setting affects Print Size
With ref to http://www.vbforums.com/showthread.php?t=625535
That one is resolved so I'm starting another...
LaVolpe,
Ref. your Post #2 in the ref thread; The problem I have with that is if I do;
Code:
Private Sub Command1_Click()
Dim thePic As StdPicture
Set thePic = LoadPicture("C:\MyDir\UserLogo.bmp")
imagewidth = ScaleX(thePic.Width, vbHimetric, vbCentimeters)
imageheight = ScaleY(thePic.Height, vbHimetric, vbCentimeters)
Printer.ScaleMode = vbCentimeters
Printer.Print " ";
Printer.PaintPicture thePic, 1, 1, imagewidth/2, imageheight/2
Printer.EndDoc
End Sub
I get a bigger image printed when the display is using 120dpi than when it is using 96dpi, I'd like it to be printed the same size regardless of the screen dpi setting. I'm guessing this is because the StdPicture reflects the Display DC rather than the Printer DC. Any way around that?
Merri, I have tried Printer.ScaleX and Y but no difference. It appears to be thePic.Width and thePic.Height which are changing not the ScaleX/Y conversion factors.
-
Aug 25th, 2010, 02:20 PM
#2
Re: Dpi setting affects Print Size
So are you saying that if you load a 256x256 image, the imageWidth & imageHeight variables are not 256x256? I'd try it myself, but am not near a point I can do pc restarts due to dpi setting changes.
-
Aug 25th, 2010, 02:30 PM
#3
Re: Dpi setting affects Print Size
Yes.
Test code;
Code:
Option Explicit
Private Sub Command1_Click()
Dim thePic As StdPicture
Dim imagewidth&, imageheight&
Printer.ScaleMode = vbCentimeters
Set thePic = LoadPicture("C:\Gds\UserLogo.bmp")
MsgBox thePic.Width & " " & thePic.Height 'returned values affected by Windows dpi setting
' imagewidth = Printer.ScaleX(thePic.Width, vbHimetric, vbCentimeters)
' imageheight = Printer.ScaleY(thePic.Height, vbHimetric, vbCentimeters)
'
' Printer.Print " ";
' Printer.PaintPicture thePic, 1, 1, imagewidth / 2, imageheight / 2
' Printer.Print
'
' Printer.EndDoc
End Sub
-
Aug 25th, 2010, 02:38 PM
#4
Re: Dpi setting affects Print Size
I have a feeling that those values should change... why aren't you using ScaleX/ScaleY as you were shown?
-
Aug 25th, 2010, 02:39 PM
#5
Re: Dpi setting affects Print Size
Originally Posted by Magic Ink
Yes.
Test code;
MsgBox thePic.Width & " " & thePic.Height 'returned values affected by Windows dpi setting
I'd expect that. But does the following return different values? when using Printer.ScaleX/Y
MsgBox imageWidth & " " & imageHeight
-
Aug 25th, 2010, 02:46 PM
#6
Re: Dpi setting affects Print Size
If I unrem the remmed code (which includes Printer.ScaleX/Y) the printed image size changes!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|