home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / ch_code / ch06 / piechart / piechart.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-02-20  |  3.0 KB  |  96 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    BackColor       =   &H00FFFFFF&
  4.    Caption         =   "PieChart Demo"
  5.    ClientHeight    =   5835
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   6915
  9.    FillStyle       =   0  'Solid
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5835
  12.    ScaleWidth      =   6915
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.CommandButton Command1 
  15.       Caption         =   "Draw Pie Chart"
  16.       BeginProperty Font 
  17.          Name            =   "MS Sans Serif"
  18.          Size            =   12
  19.          Charset         =   0
  20.          Weight          =   700
  21.          Underline       =   0   'False
  22.          Italic          =   0   'False
  23.          Strikethrough   =   0   'False
  24.       EndProperty
  25.       Height          =   405
  26.       Left            =   165
  27.       TabIndex        =   2
  28.       Top             =   5175
  29.       Width           =   2565
  30.    End
  31.    Begin VB.CheckBox Check2 
  32.       BackColor       =   &H00FFFFFF&
  33.       Caption         =   "Fill with Color"
  34.       BeginProperty Font 
  35.          Name            =   "MS Sans Serif"
  36.          Size            =   12
  37.          Charset         =   0
  38.          Weight          =   400
  39.          Underline       =   0   'False
  40.          Italic          =   0   'False
  41.          Strikethrough   =   0   'False
  42.       EndProperty
  43.       Height          =   300
  44.       Left            =   150
  45.       TabIndex        =   1
  46.       Top             =   525
  47.       Width           =   2130
  48.    End
  49.    Begin VB.CheckBox Check1 
  50.       BackColor       =   &H00FFFFFF&
  51.       Caption         =   "Fill with Pattern"
  52.       BeginProperty Font 
  53.          Name            =   "MS Sans Serif"
  54.          Size            =   12
  55.          Charset         =   0
  56.          Weight          =   400
  57.          Underline       =   0   'False
  58.          Italic          =   0   'False
  59.          Strikethrough   =   0   'False
  60.       EndProperty
  61.       Height          =   300
  62.       Left            =   150
  63.       TabIndex        =   0
  64.       Top             =   210
  65.       Width           =   2220
  66.    End
  67. Attribute VB_Name = "Form1"
  68. Attribute VB_GlobalNameSpace = False
  69. Attribute VB_Creatable = False
  70. Attribute VB_PredeclaredId = True
  71. Attribute VB_Exposed = False
  72. Private Sub Command1_Click()
  73. Dim PieData(10) As Integer
  74.     Form1.Cls
  75.     For i = 0 To 9
  76.         PieData(i) = 20 + Rnd() * 100
  77.         Total = Total + PieData(i)
  78.     Next
  79.     Form1.DrawWidth = 2
  80.     For i = 0 To 9
  81.         arc1 = arc2
  82.         arc2 = arc1 + 6.28 * PieData(i) / Total
  83.         If Check1.Value Then
  84.             Form1.FillStyle = 2 + (i Mod 5)
  85.         Else
  86.             Form1.FillStyle = 0
  87.         End If
  88.         If Check2.Value Then
  89.             Form1.FillColor = QBColor(8 + (i Mod 6))
  90.         Else
  91.             Form1.FillColor = QBColor(9)
  92.         End If
  93.         Form1.Circle (Form1.ScaleWidth / 2, Form1.ScaleHeight / 2), Form1.ScaleHeight / 2.5, , -arc1, -arc2
  94.     Next
  95. End Sub
  96.