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

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