How to get a resolution for graphics 
Author Message
 How to get a resolution for graphics

I'm learning how to program in VB6. I followed a code example
of how to use graphic methods to draw patterns and circles with
different colors on a form and to the SavePicture statement to
save the graphics in a bitmap file. The graphics, however, are of
poor quality with only 96 pixels/inch resolutions. I want the graphics
to have a resolution of 300 pixels/inch but don't know how.

A friend of mine, who is also a VB newbie, says that maybe the
graphic methods (Circle, Line...) in the example cannot produce
graphics of high resolution, and that I may have to use some API
functions to draw and save the graphics.

Could somebody please tell me which API functions I have to call.
If possible, please give some codes illustrating how this is done.

Any help is greatly appreciated. Thanks in advance.



Sat, 01 Dec 2001 03:00:00 GMT  
 How to get a resolution for graphics
Bitmaps are pixel-based raster graphics.  And they are device-independent.
Therefore, "pixels/inch" is entirely fictional for bitmaps.  They _do_
contain this information in their headers (as pel{*filter*}eter), but nearly all
software ignores it, and for most bitmaps it is simply set to zero.  If you
have software that does not ignore it, you can change it in the headers of
any bitmap files you've got:  look up the BITMAPINFOHEADER in the SDK.

So, really, resolution comes down to simply width and height.

There _is_ a bug in VB pictureboxes (unless they've fixed it in VB6) that
prevents the Line, Circle, Print, etc methods from drawing to a picturebox
at positions beyond 32767 twips from the origin (in any ScaleMode).  Still,
that's a pretty good resolution: at 12 twips/pixel, that's a 2730 x 2730
bitmap.  At 300 pixels/inch it's about nine inches square.

If you need more resolution than that, you can use the API drawing functions
on the picturebox instead.  Functions such as LineTo(), MoveTo(), DrawText()
etc. can do just about all the things the VB functions do plus more.  You'll
want to use AutoRedraw = True on your picturebox.

Jim Deutch
MS Dev MVP


Quote:
>I'm learning how to program in VB6. I followed a code example
>of how to use graphic methods to draw patterns and circles with
>different colors on a form and to the SavePicture statement to
>save the graphics in a bitmap file. The graphics, however, are of
>poor quality with only 96 pixels/inch resolutions. I want the graphics
>to have a resolution of 300 pixels/inch but don't know how.

>A friend of mine, who is also a VB newbie, says that maybe the
>graphic methods (Circle, Line...) in the example cannot produce
>graphics of high resolution, and that I may have to use some API
>functions to draw and save the graphics.

>Could somebody please tell me which API functions I have to call.
>If possible, please give some codes illustrating how this is done.

>Any help is greatly appreciated. Thanks in advance.



Sun, 02 Dec 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Graphics Resolution Viewer.

2. Changing graphic resolution under vb4

3. Changing graphic resolution

4. Graphic resolution

5. API-call for getting/adjusting sreen resolution

6. Getting the screen resolution?

7. getting time at sub-second resolution

8. Getting the resolution of a viewer in asp!?

9. Getting Screen Resolution

10. Getting the screen resolution

11. getting user resolution

12. Vector Graphics Getting Started.

 

 
Powered by phpBB® Forum Software