Windows API Guide: mciSendString Function


Declare Function OffsetRgn Lib "gdi32.dll" (ByVal hRgn As Long, ByVal x As Long, ByVal y As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

OffsetRgn translates (slides) a region by a specified amount horizontally and vertically. The region can be moved in any direction left, right, up, or down. The function returns 0 if an error occured, or exactly one of the following flags identifying the shape of the region which was moved:

COMPLEXREGION = 3
The region is not empty but is not a rectangle.
NULLREGION = 1
The region is empty, i.e., null.
SIMPLEREGION = 2
The region is rectangular in shape.
hRgn
A handle to the region to move.
x
The number of pixels to move the region horizontally. Positive values move to the right; negative ones move to the left.
y
The number of pixels to move the region vertically. Positive values move down; negative ones move up.

Example:

' On window Form1, fill an elliptical region in light gray.  Then translate the ' region 50 pixels right and 20 pixels up and fill it with dark gray. Dim hRgn As Long  ' handle to the region Dim hLightBrush As Long, hDarkBrush As Long  ' handles to the two brushes to be used Dim retval As Long  ' generic return value ' Create the elliptical region. hRgn = CreateEllipticRgn(20, 100, 220, 200)  ' bounding rectangle (20,100)-(220,200) ' Get handles to the light and dark gray solid stock brushes. hLightBrush = GetStockObject(LTGRAY_BRUSH) hDarkBrush = GetStockObject(DKGRAY_BRUSH) ' Fill in the region in its current location on Form1 in light gray. retval = FillRgn(Form1.hDC, hRgn, hLightBrush) ' Slide the region 50 pixels right and 20 pixels up. retval = OffsetRgn(hRgn, 50, -20)  ' -20 means 20 up, not down ' Fill in the region in its new location in dark gray. retval = FillRgn(Form1.hDC, hRgn, hDarkBrush) ' Delete the region to free up resources. retval = DeleteObject(hRgn)

Category: Regions

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/o/offsetrgn.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net