FrameRgn Function

Declare Function FrameRgn Lib "gdi32.dll" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long

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

FrameRgn draws a frame (border) around a given region on a device using the specified brush. The device's currently selected brush is not used. The width and height of the drawn frame are also specified by the function. The function returns 0 if an error occured, or a non-zero value if successful.

hdc
A device context to the device to draw on.
hRgn
A handle to the region to draw the frame of.
hBrush
A handle to the brush to use to draw the frame.
nWidth
The width in pixels of vertical brush strokes to use to draw the frame.
nHeight
The height in pixels of horizontal brush strokes to use to draw the frame.

Example:

' Draw a frame around an elliptical region on window Form1.  The frame will
' have a width of 5 and a height of 3.  The region has bounding rectangle (20,30)-(220,180).
' A green diagonally cross-hatched brush is used.
Dim hRgn As Long  ' handle to the region to frame
Dim hBrush As Long  ' handle to the green diagonally cross-hatched brush
Dim retval As Long  ' generic return value

' Create the elliptical region and the brush.
hRgn = CreateEllipticRgn(20, 30, 220, 180)  ' elliptical region
hBrush = CreateHatchBrush(HS_DIAGCROSS, RGB(0, 255, 0))  ' brush

' Frame the region using the created brush.
retval = FrameRgn(Form1.hDC, hRgn, hBrush, 5, 3)  ' frame width = 5, height = 3

' Delete the region and brush to free up resources.
retval = DeleteObject(hRgn)
retval = DeleteObject(hBrush)

See Also: FillRgn, FrameRect
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/f/framergn.html