home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples5 / ch07 / frmcomb.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  3.6 KB  |  117 lines

  1. VERSION 5.00
  2. Begin VB.Form frmCombine 
  3.    Caption         =   "Combined Region"
  4.    ClientHeight    =   3735
  5.    ClientLeft      =   1500
  6.    ClientTop       =   3465
  7.    ClientWidth     =   6870
  8.    LinkTopic       =   "Form2"
  9.    PaletteMode     =   1  'UseZOrder
  10.    ScaleHeight     =   249
  11.    ScaleMode       =   3  'Pixel
  12.    ScaleWidth      =   458
  13.    Begin VB.PictureBox picCombined 
  14.       FillColor       =   &H0000FFFF&
  15.       FillStyle       =   0  'Solid
  16.       ForeColor       =   &H00FF00FF&
  17.       Height          =   3015
  18.       Left            =   60
  19.       ScaleHeight     =   199
  20.       ScaleMode       =   3  'Pixel
  21.       ScaleWidth      =   444
  22.       TabIndex        =   1
  23.       Top             =   60
  24.       Width           =   6690
  25.       Begin VB.Label Label1 
  26.          Caption         =   "PolyPolygonal Region:"
  27.          Height          =   195
  28.          Left            =   180
  29.          TabIndex        =   6
  30.          Top             =   1320
  31.          Width           =   1695
  32.       End
  33.       Begin VB.Label lblRoundRect 
  34.          Caption         =   "Round Rectangular:"
  35.          Height          =   195
  36.          Left            =   4500
  37.          TabIndex        =   5
  38.          Top             =   60
  39.          Width           =   1515
  40.       End
  41.       Begin VB.Label lblPolygon 
  42.          Caption         =   "Polygon:"
  43.          Height          =   195
  44.          Left            =   3120
  45.          TabIndex        =   4
  46.          Top             =   60
  47.          Width           =   1275
  48.       End
  49.       Begin VB.Label lblElliptic 
  50.          Caption         =   "Elliptic:"
  51.          Height          =   195
  52.          Left            =   1680
  53.          TabIndex        =   3
  54.          Top             =   60
  55.          Width           =   855
  56.       End
  57.       Begin VB.Label lblRect 
  58.          Caption         =   "Rectangular:"
  59.          Height          =   195
  60.          Left            =   180
  61.          TabIndex        =   2
  62.          Top             =   60
  63.          Width           =   1035
  64.       End
  65.    End
  66.    Begin VB.CommandButton cmdExit 
  67.       Cancel          =   -1  'True
  68.       Caption         =   "E&xit"
  69.       Default         =   -1  'True
  70.       Height          =   555
  71.       Left            =   5460
  72.       TabIndex        =   0
  73.       Top             =   3120
  74.       Width           =   1335
  75.    End
  76. Attribute VB_Name = "frmCombine"
  77. Attribute VB_GlobalNameSpace = False
  78. Attribute VB_Creatable = False
  79. Attribute VB_PredeclaredId = True
  80. Attribute VB_Exposed = False
  81. Option Explicit
  82. ' Copyright 
  83.  1997 by Desaware Inc. All Rights Reserved
  84. Dim fClip As Integer, dl
  85. Dim hCombinedRegion As Long
  86. Public Sub Initialize(CmdButton As Integer, useRegion As Long)
  87.     Select Case CmdButton
  88.         Case 0
  89.             fClip = False
  90.         Case 1
  91.             fClip = True
  92.     End Select
  93.     ' Don't delete this copy - it's owned by the other form.
  94.     hCombinedRegion = useRegion
  95.     Me.Show 1
  96. End Sub
  97. Private Sub cmdExit_Click()
  98.     Unload Me
  99. End Sub
  100. Private Sub picCombined_Paint()
  101.     Dim savedDC, i%
  102.     If Not fClip Then
  103.         picCombined.FillColor = QBColor(13) 'Magenta
  104.         dl = PaintRgn(picCombined.hDC, hCombinedRegion)
  105.     Else
  106.         savedDC = SaveDC(picCombined.hDC)
  107.         dl = SelectClipRgn(picCombined.hDC, hCombinedRegion)
  108.         picCombined.ForeColor = QBColor(13)
  109.         ' Draw a bunch of horizontal lines to illustrate clipping
  110.         For i% = 1 To 300 Step 2
  111.             picCombined.Line (0, i%)-(500, i%)
  112.         Next i%
  113.         picCombined.ForeColor = QBColor(0)
  114.         dl = RestoreDC(picCombined.hDC, savedDC)
  115.     End If
  116. End Sub
  117.