GefScreen.PositionWithGeometry (method)

Positions the screen according to the contents of the passed geometry string.
Syntax: Boolean = object.PositionWithGeometry ( GeometryString )
Parameters:
GeometryString As String -
Description: Positions the screen according to the contents of the passed geometry string. The geometry sting is the same string used after the /geometry flag on the command line.

The geometry specification has the following BNF definition.
<geometry> ::= [<size>][<position>][<displaysurface>]

<size> ::= <widthspec>"x"<heightspec>

<widthspec> ::= <dimension>
Specifies the width of the screen

<heightspec> ::= <dimension>
Specifies the height of the screen

<dimension> ::= <constantValue> | <percentage>

<constantValue> ::= <unsigned_integer>
A <constantValue> is an integer that specifies a fixed value in pixels

<percentage> ::= <float>"%"
A <percentage> is a floating point number that specifies the percentage of the <displaysurface> height or width.

<position> ::= <edgeSpec><xOffSet><edgeSpec><yOffSet>

<edgeSpec> ::= "+" | "-"
An <edgeSpec> of + indicates the <xOffSet> is the distance between left edge of the screen and the left edge of the <displaysurface>. And the <yOffSet> is the distance between top edge of the screen and the top edge of the <displaysurface>. Whereas an <edgeSpec> of - indicates <xOffSet> is the distance between right edge of the screen and the right edge of the <displaysurface>. And the <yOffSet> is the distance between bottom edge of the screen and the bottom edge of the <displaysurface>.

<xOffSet> ::= <offSetSpec>
Specifies the distance between the left or right edge of the screen and the left or right edge of the <displaysurface>.

<yOffSet> ::= <offSetSpec>
Specifies the distance between the top or bottom edge of the screen and the top or bottom edge of the <displaysurface>.

<offSetSpec> ::= "C" | "c" | <dimension>
An <offSetSpec> of "C" or "c" indicates the screen will be centered on the <displaysurface>. Whereas a <dimension> indicates the distance between the edges specified in the preceding <edgeSpec>.

<displaysurface> ::= "@" ("V" | "v" | "P" | "p" | <unsigned_integer>)["W" | "w"]
A <displaysurface> of "@V" indicates the whole virtual display is used for doing <dimension> calculations. The virtual display is the smallest rectangle that will enclose all of the monitors attached to the desktop. Depending on the arrangement and sizes of the monitors it is possible that regions exist in the virtual display that are not visible. When the <displaysurface> is "@<unsigned_integer>" it represents the monitor with the corresponding number seen on the display settings property page of windows (one based index). A <displaysurface> of "@P" indicates that the primary monitor should be used. Finally the W or w suffix specifies that the working area of a monitor should be used. The working area may be the same as the whole area. However, if the monitor contains the task bar the working area of the monitor is the area of the display not covered by the task bar. If only the <displaysurface> is specified in the <geometry> then the screen is moved with its present size to the center of the indicated <displaysurface>

Example Strings:

"80%x20%+0+0@2"
Displays the screen so that it is 80% of the width of monitor 2's width, 20% of the height and in the top left corner of monitor 2.

"-0%-0%@PW"
Moves the screen with its present size to the lower right corner of the working area of the primary monitor. If there is a task bar on the lower edge of the monitor the screen will have no overlapping regions with it.

"-0-0"
Moves the screen with its present size to the lower right corner of the of the primary monitor. If there is a task bar on the lower edge of the monitor the screen will be partially covered by the task bar.

"50%x60%+0+20%@2W"
Sizes the screen so that it is 50% of the width of monitor 2's working area, and 60% of the of width. It also positions it so that the left edge of the screen is at the left edge of the monitor's working area and the top is offset from the top of the monitor's working area by 20% of the working height of the monitor.

"50%x60%-0-20%@2W"
Sizes the screen so that it is 50% of the width of monitor 2's working area, and 60% of the of the width. It also positions it so that the right edge of the screen is at the right edge of the monitor's working area and the bottom of the screen is offset from the bottom of the working area of the monitor by 20% of the working height of the monitor.

"@2"
Moves the screen with its present size to the center of monitor 2.

"100%x100%+c+c@V"
Sizes the screen to cover the entire virtual display and moves the screen to the center the virtual display.

Example:

Sub GefScreen_PositionWithGeometry()
 
  CimGetScreen.PositionWithGeometry "50%x60%+0+20%@2"
 
End Sub