![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!
Chapter 12
|
Table 12.1 Visual Basic scale settings. | |
ScaleMode Value | Scale Units |
---|---|
0 | Custom |
1. | Twip (default); there are 1,440 twips per logical inch and 567 twips per logical centimeter |
2. | Point; there are 72 points per logical inch |
3. | Pixel; this is the smallest unit of monitor or printer resolution |
4. | Character; one character unit equals 120 twips horizontally and 240 twips vertically |
5. | Inch |
6. | Millimeter |
7 | Centimeter |
Before we look at the various object properties that are related to the coordinate system, lets look at the Big Daddy (or Big Mommy, if you prefer) of all containers, the Screen object.
The Screen object is Visual Basics logical representation of the entire display screen. Screen coordinates are always measured in twips, and the top-left corner is always located at (0, 0). The physical size of the screen varies from system to system; knowing the screen size will help you make the best use of available screen real estate. You wouldnt want your programs forms to extend off the edge of the screen. You can query two of the Screen objects properties, Width and Height, to obtain the screen size:
ScreenWidthInTwips = Screen.Width ScreenHeightInTwips = Screen.Height
Although you cant change these properties, knowing their valuesand hence, the screen sizewill help you determine the appropriate position and size for your forms. The Screen object has some other properties you need to know about.
The TwipsPerPixelX and TwipsPerPixelY properties return the number of twips per screen pixel. A pixel is the smallest dot of light that can be displayed on the screen, and the physical resolution of a particular display is expressed in terms of horizontal and vertical pixels. When a program is running, the number of twips per pixel will depend on the systems hardware configuration, as well as the settings of the Windows display driver. You can use these properties to match your programs graphics to the screen characteristics. For example, to draw the thinnest possible horizontal line, you would set the line thickness equal to Screen.TwipsPerPixelY twips. The result is a line that is precisely one pixel thick. You can also calculate the current screen resolutionthe number of pixels horizontally and vertically:
Xres = Screen.Width / Screen.TwipsPerPixelX Yres = Screen.Height / Screen.TwipsPerPixelY
The MousePointer property specifies the appearance of the mouse pointer while it is over a Visual Basic screen element. With the default setting of 0, the pointer is controlled by the MousePointer property of the individual objects in the program (form, control, etc.)that is, whichever object the mouse happens to be over at the moment. Other possible settings for the Screen objects MousePointer property are given in Table 12.2.
A MousePointer property setting of 99 lets you define your own cursor using the MouseIcon property. In the statement
Screen.MouseIcon = picture
Previous | Table of Contents | Next |
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |