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 / samples4 / ch07 / frmcomb.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  3.6 KB  |  118 lines

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