Using API BitBlt in VB6

nguyenthanhcanh
02-15-2005, 07:47 PM
Dear all
I want to use BitBlt in Twip unit , insted of pixel, for shifting elements in trend graph.
Can I use or convert Pixel to Twip exactly? How can I do?
Thank you.

webbone
02-15-2005, 07:54 PM
You can convert between Twips and Pixels using the property values of .TwipsPerPixelX and .TwipsPerPixelY, i.e. Form1.TwipsPerPixelX.

Most Windows API functions require using pixels so you will have to do conversions using the above values.

For more on these properties see MSDN: http://msdn.microsoft.com/library/en-us/vb98/html/vbproTwipsPerPixelX.asp

Also, Please do not post the same question in multiple forums. If needed a moderator will move to the appropriate location.

passel
02-15-2005, 08:01 PM
Since BitBlt requires Pixels, you will need to convert the twips from your graph into
pixel coordinates for bitblt.

You can use the Screen.TwipsPerPixelX and Y to find out how many twips there are
per pixel (which can vary from machine to machine).

You can also use the ScaleX and ScaleY functions to convert between scales.

If you can't find the ScaleX and ScaleY in your VB help, try using the Search button
above (between the FAQ and "Quick Links" buttons) and search on the word ScaleX.
You will probably find a few examples.

herilane
02-16-2005, 02:37 AM
I've merged your two threads about this question. In the future, please choose ONE forum, and post only there. If it turns out that you've chosen a bad one, the thread can always be moved later.

passel
02-16-2005, 07:06 AM
Dear all
I want to use BitBlt in Twip unit , insted of pixel, for shifting elements in trend graph.
Can I use or convert Pixel to Twip exactly? How can I do?
Thank you.

And just for possible clarification, a pixel is the smallest "dot" that can be
drawn on the screen. So even though there are multiple twips per pixel
(usually 12 or 15 depending on your DPI setting) seeming to give you a finer
resolution for your scale, since you can't draw any smaller than a pixel, you
are not ending up with more information displayed on the screen.

If you had the scale set to twips and executed the following code.

Pset (0,0), vbRed
Pset (0,1), vbRed
Pset (0,2), vbRed
Pset (0,3), vbRed
Pset (0,4), vbRed


It should look no different than if you executed only one of those Psets
since they will all write to the same pixel. You will have only one dot on the
screen, not 5.

It's usually not a good idea to use twips for graphics, since the number of
Twips Per Pixel can vary (my machine at work is 12, and at home is 15) and
things like boxes or gridlines that line up great on one machine can overlap or
have gaps or be uneven on the other.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum