home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Eagles Nest BBS 6
/
Eagles_Nest_Mac_Collection_Disc_6.TOAST
/
Windows
/
VisBasAPIex
/
VBAPIGUIDE.image
/
CLIPVIEW.FRM
< prev
next >
Wrap
Text File
|
1992-12-01
|
2KB
|
76 lines
VERSION 2.00
Begin Form Clipview
Caption = "Clipping Region Demo"
Height = 4710
Left = 1035
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 4020
ScaleWidth = 7365
Top = 1140
Width = 7485
Begin Menu MenuRegion
Caption = "Region"
Begin Menu MenuElliptic
Caption = "Elliptic"
End
Begin Menu MenuEllipticNorect
Caption = "Elliptic-Rect"
End
End
End
' Create an eliptical region that fits in the window
'
Sub MenuElliptic_Click ()
Dim rc As RECT
GetClientRect hWnd, rc
ClippingRegion% = CreateEllipticRgnIndirect(rc)
' ShowClip selects the ellipse as the clipping region,
' then fills the window to show the clipping effect.
ShowClip ClippingRegion%
' Be sure to delete the region when done.
dummy% = DeleteObject(ClippingRegion%)
End Sub
' This shows the creation of a more complex region.
'
Sub MenuEllipticNorect_Click ()
Dim rc As RECT, rc2 As RECT
Dim rgn2%
GetClientRect hWnd, rc
' Start with the same clipping region used in MenuElliptic
ClippingRegion% = CreateEllipticRgnIndirect(rc)
' Make a copy of a rectangle describing the form size
dummy% = CopyRect(rc2, rc)
' Shrink it by 75 pixels on a side
InflateRect rc2, -75, -75
' Then convert the rectangle into a region
rgn2% = CreateRectRgnIndirect(rc2)
' Combine the regions using the difference operation
dummy% = CombineRgn(ClippingRegion%, ClippingRegion%, rgn2%, RGN_DIFF)
' And now select this as the clipping region.
ShowClip ClippingRegion%
' Delete both regions when done
dummy% = DeleteObject(ClippingRegion%)
dummy% = DeleteObject(rgn2%)
End Sub
' Selects the specified region as the clipping region,
' the fills the form. Only the area in the region will be
' filled - the rest is "clipped" out.
'
Sub ShowClip (rgn%)
clipview.Cls
dummy% = SelectClipRgn%(clipview.hDC, rgn%)
Line (0, 0)-(clipview.ScaleWidth, clipview.ScaleHeight), , BF
dummy% = SelectClipRgn%(clipview.hDC, 0)
End Sub