Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2004, 10:35 AM
Authorized User
 
Join Date: May 2004
Posts: 83
Thanks: 0
Thanked 1 Time in 1 Post
Default Inches 2 Pixels Conversion

Hi!

I want to know EXACTLY how 2 find the equivalent of inches in pixels and vice versa. PLz also comment on what effect the screen resolution will have on this conversion.

Regards

ejan
__________________
ejan
 
Old October 18th, 2004, 01:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The fastest way is to use the ScaleX method (of a Form, PictureBox, UserControl as I remember)
myForm.ScaleX(1, vbInches, vbPixels)
regarding you second question, what do you want to achieve?
Marco
 
Old October 19th, 2004, 07:57 PM
Authorized User
 
Join Date: May 2004
Posts: 83
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well,

Frankly, I had used both the ScaleX and ScaleY methods before I posted the above question. These two methods also exist 4 the Printer object & that is what is of more interest 4 me. But, unfortunately, when I call the ScaleX or ScaleY method on the Printer object, it raises, almost always, runtime error 11 with no error description.

U should have guessed by now what I want to accomplish. Actually, the SetUserPaperSize method of the CRAXDRT.Report (Crystal Reports 9 ActiveX Runtime)object expects the height and width of a page in pixels (quite oddly!) in order to define a custom size 4 the paper at runtime. I've used the ScaleX aand ScaleY methods to get my desired value in inches but it always returns the page width and height shorter than what I expect. I am always able to set the page dimensions dynamically by using hit and try method and finding an appropriate value 4 the length and height of the page.

ejan
 
Old October 20th, 2004, 04:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should have said that you were using a Printer. In the Printer object pixels do not have sense, you can use twips or points (the error you get is division by zero, that means that the pixels factor is not initialized in the printer)
Regarding the craxdrt report (I never used it) I agree with you that pixel units was a wrong choice! Are you sure it cannot be changed?
Good luck,
Marco





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to count Pixels AccessAasif@aol.com C# 2005 1 November 26th, 2007 05:28 AM
Counting pixels shanthi85 VB How-To 0 May 22nd, 2007 02:13 AM
what is best way to determine pixels of pic audi Dreamweaver (all versions) 4 January 1st, 2006 09:20 AM
get size (W x H, pixels) of .swf archive ACE2084 Javascript How-To 0 April 27th, 2005 11:32 AM
get size (W x H, pixels) of .swf archive ACE2084 ASP.NET 1.0 and 1.1 Basics 1 April 26th, 2005 04:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.