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 / round.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  2.0 KB  |  63 lines

  1. VERSION 5.00
  2. Begin VB.Form frmRound 
  3.    Caption         =   "Round Window"
  4.    ClientHeight    =   1515
  5.    ClientLeft      =   1080
  6.    ClientTop       =   1515
  7.    ClientWidth     =   2415
  8.    LinkTopic       =   "Form1"
  9.    PaletteMode     =   1  'UseZOrder
  10.    ScaleHeight     =   1515
  11.    ScaleWidth      =   2415
  12.    Begin VB.CommandButton Command1 
  13.       Caption         =   "Command1"
  14.       Height          =   435
  15.       Left            =   660
  16.       TabIndex        =   0
  17.       Top             =   540
  18.       Width           =   915
  19.    End
  20.    Begin VB.PictureBox Picture1 
  21.       Height          =   780
  22.       Left            =   480
  23.       Picture         =   "Round.frx":0000
  24.       ScaleHeight     =   750
  25.       ScaleWidth      =   1200
  26.       TabIndex        =   1
  27.       Top             =   360
  28.       Width           =   1230
  29.    End
  30.    Begin VB.Label Label1 
  31.       Height          =   195
  32.       Left            =   60
  33.       TabIndex        =   2
  34.       Top             =   60
  35.       Width           =   2295
  36.    End
  37. Attribute VB_Name = "frmRound"
  38. Attribute VB_GlobalNameSpace = False
  39. Attribute VB_Creatable = False
  40. Attribute VB_PredeclaredId = True
  41. Attribute VB_Exposed = False
  42. Option Explicit
  43. ' Copyright 
  44.  1997 by Desaware Inc. All Rights Reserved
  45. Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  46. Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
  47. Private Sub Command1_Click()
  48.     Label1.BackColor = RGB(0, 255, 0)
  49.     Label1.Caption = "Button clicked"
  50. End Sub
  51. Private Sub Form_Load()
  52.     Dim hr&, dl&
  53.     Dim usew&, useh&
  54.     usew& = Command1.Width / Screen.TwipsPerPixelX
  55.     useh& = Command1.Height / Screen.TwipsPerPixelY
  56.     hr& = CreateEllipticRgn(0, 0, usew, useh)
  57.     dl& = SetWindowRgn(Command1.hWnd, hr, True)
  58. End Sub
  59. Private Sub Picture1_Click()
  60.     Label1.BackColor = RGB(255, 0, 0)
  61.     Label1.Caption = "Picture clicked"
  62. End Sub
  63.