Search Tools Links Login

Size into pixels


Here is a real simple way to convert the size of vb into pixels.

Original Author: SPY-3

Code

I found that if you want to convert the vb size into pixels simply do this

(of course change vbsize to how large the control is ex 495)

Pixels = vbsize / Screen.TwipsPerPixelX or Y

To turn pixels into vb

(Change pixels into how many pixels ex 33)

VB = pixels * Screen.TwipsPerPixelX or Y

Examples:

txtPixelHeight.Text = 495 / Screen.TwipsPerPixelX or Y

Me.Height = 33 * Screen.TwipsPerPixelX or Y

Hope this helps and please vote.
You are free to change or modify this code however you want.

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 105 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.