Click to See Complete Forum and Search --> : finding pixels in an image
rchiav
May 5th, 2000, 10:46 PM
As a little expierement, I want to do some calculations on pixles in an image. How do I get the number of pixles in X and Y directions... so I can create a table of the same size.. thanks..
kedaman
May 6th, 2000, 02:41 AM
What scales are you using? To convert between pixels and twips use twipsperpixelx and twipsperpixely
Guv
May 6th, 2000, 04:18 AM
I am using VB6 & Windows 98, Second Edition. I have Visual Studio installed on my System.
The following resulted in values like (640 & 480), (800 & 600), (1024 & 768), et cetera.
Dim PixelsX As Integer
Dim PixelsY As Integer
PixelsX = Screen.Width / Screen.TwipsPerPixelX
PixelsY = Screen.Height / Screen.TwipsPerPixelYl
I have been experimenting with resizing Forms & Picture Boxes when Screen Resolution changes. The above worked for me. I do not think it is necessary, but my form had a Sysinfo Control (Try adding one, if the above does not work for you).
Some of the data from the system is still confusing to me. For example: Form Width & Height seem to be measured in "Logical" Twips (No change when Screen Resolution changes, and the size of the Form has obviously changed). Screen Width & Height seem to be measured in Absolute Twips, changing when Screen Resolution changes. Note that WorkArea Width & Height take the size of the Task Bar into account.
The VB documentation has often omitted some crucial data, so I advise experimenting.
Fox
May 6th, 2000, 05:38 PM
If you mean the size like you get it from the iPictureDisp object you have to scale them by form:
x = Form1.ScaleX( Form1.Picture.Width )
y = Form1.ScaleY( Form1.Picture.Height )
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.