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

  1. VERSION 5.00
  2. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Grid Demo"
  5.    ClientHeight    =   4455
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   6945
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   4455
  11.    ScaleWidth      =   6945
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.ComboBox Combo2 
  14.       Height          =   315
  15.       Left            =   2415
  16.       TabIndex        =   4
  17.       Text            =   "10"
  18.       Top             =   3870
  19.       Width           =   2025
  20.    End
  21.    Begin VB.ComboBox Combo1 
  22.       Height          =   315
  23.       Left            =   360
  24.       TabIndex        =   3
  25.       Text            =   "10"
  26.       Top             =   3870
  27.       Width           =   2025
  28.    End
  29.    Begin VB.CommandButton Command1 
  30.       Caption         =   "Reset FontWidth"
  31.       BeginProperty Font 
  32.          Name            =   "Verdana"
  33.          Size            =   9.75
  34.          Charset         =   0
  35.          Weight          =   400
  36.          Underline       =   0   'False
  37.          Italic          =   0   'False
  38.          Strikethrough   =   0   'False
  39.       EndProperty
  40.       Height          =   660
  41.       Left            =   4605
  42.       TabIndex        =   2
  43.       Top             =   3525
  44.       Width           =   2025
  45.    End
  46.    Begin MSFlexGridLib.MSFlexGrid Grid 
  47.       Height          =   2730
  48.       Left            =   345
  49.       TabIndex        =   0
  50.       Top             =   660
  51.       Width           =   6150
  52.       _ExtentX        =   10848
  53.       _ExtentY        =   4815
  54.       Rows            =   13
  55.       Cols            =   5
  56.       AllowUserResizing=   1
  57.    End
  58.    Begin VB.Label Label3 
  59.       Caption         =   "Select FontWidth"
  60.       BeginProperty Font 
  61.          Name            =   "Verdana"
  62.          Size            =   9
  63.          Charset         =   0
  64.          Weight          =   400
  65.          Underline       =   0   'False
  66.          Italic          =   0   'False
  67.          Strikethrough   =   0   'False
  68.       EndProperty
  69.       Height          =   300
  70.       Left            =   2430
  71.       TabIndex        =   6
  72.       Top             =   3510
  73.       Width           =   1980
  74.    End
  75.    Begin VB.Label Label2 
  76.       Caption         =   "Select FontSize"
  77.       BeginProperty Font 
  78.          Name            =   "Verdana"
  79.          Size            =   9
  80.          Charset         =   0
  81.          Weight          =   400
  82.          Underline       =   0   'False
  83.          Italic          =   0   'False
  84.          Strikethrough   =   0   'False
  85.       EndProperty
  86.       Height          =   300
  87.       Left            =   405
  88.       TabIndex        =   5
  89.       Top             =   3510
  90.       Width           =   1980
  91.    End
  92.    Begin VB.Label Label1 
  93.       Alignment       =   2  'Center
  94.       BorderStyle     =   1  'Fixed Single
  95.       Caption         =   "Profit Comparison Table"
  96.       BeginProperty Font 
  97.          Name            =   "Verdana"
  98.          Size            =   15.75
  99.          Charset         =   0
  100.          Weight          =   400
  101.          Underline       =   0   'False
  102.          Italic          =   0   'False
  103.          Strikethrough   =   0   'False
  104.       EndProperty
  105.       Height          =   540
  106.       Left            =   360
  107.       TabIndex        =   1
  108.       Top             =   45
  109.       Width           =   6120
  110.    End
  111. Attribute VB_Name = "Form1"
  112. Attribute VB_GlobalNameSpace = False
  113. Attribute VB_Creatable = False
  114. Attribute VB_PredeclaredId = True
  115. Attribute VB_Exposed = False
  116. Option Explicit
  117. Dim MonthNames(12) As String
  118. Dim Profit96(12) As Integer
  119. Dim Profit97(12) As Integer
  120. Private Sub Combo1_Click()
  121.     Grid.FillStyle = flexFillRepeat
  122.     Grid.Col = 1
  123.     Grid.Row = 1
  124.     Grid.ColSel = 4
  125.     Grid.RowSel = 12
  126.     Grid.CellFontSize = Val(Combo1.Text)
  127.     Grid.FillStyle = flexFillSingle
  128.     Grid.Row = 1
  129.     Grid.ColSel = 1
  130. End Sub
  131. Private Sub Combo2_Click()
  132.     Grid.FillStyle = flexFillRepeat
  133.     Grid.Col = 1
  134.     Grid.Row = 1
  135.     Grid.ColSel = 4
  136.     Grid.RowSel = 12
  137.     Grid.CellFontWidth = Val(Combo2.Text)
  138.     Grid.FillStyle = flexFillSingle
  139.     Grid.Row = 1
  140.     Grid.ColSel = 1
  141. End Sub
  142. Private Sub Command1_Click()
  143.     Grid.FillStyle = flexFillRepeat
  144.     Grid.Col = 1
  145.     Grid.Row = 1
  146.     Grid.ColSel = 4
  147.     Grid.RowSel = 12
  148.     Grid.CellFontWidth = 0
  149. End Sub
  150. Private Sub Command3_Click()
  151. End Sub
  152. Private Sub Command4_Click()
  153. End Sub
  154. Private Sub Form_Load()
  155. Combo1.AddItem "8"
  156. Combo1.AddItem "10"
  157. Combo1.AddItem "12"
  158. Combo1.AddItem "14"
  159. Combo1.AddItem "16"
  160. Combo1.AddItem "18"
  161. Combo1.AddItem "20"
  162. Combo1.AddItem "22"
  163. Combo1.AddItem "24"
  164. Combo2.AddItem "0"
  165. Combo2.AddItem "2"
  166. Combo2.AddItem "4"
  167. Combo2.AddItem "6"
  168. Combo2.AddItem "8"
  169. Combo2.AddItem "10"
  170. Combo2.AddItem "12"
  171. Combo2.AddItem "14"
  172. Combo2.AddItem "16"
  173. Combo2.AddItem "18"
  174. Combo2.AddItem "20"
  175. MonthNames(1) = "January"
  176. MonthNames(2) = "February"
  177. MonthNames(3) = "March"
  178. MonthNames(4) = "April"
  179. MonthNames(5) = "May"
  180. MonthNames(6) = "June"
  181. MonthNames(7) = "July"
  182. MonthNames(8) = "August"
  183. MonthNames(9) = "September"
  184. MonthNames(10) = "October"
  185. MonthNames(11) = "November"
  186. MonthNames(12) = "December"
  187. Profit96(1) = 22060
  188. Profit96(2) = 21440
  189. Profit96(3) = 20450
  190. Profit96(4) = 19020
  191. Profit96(5) = 18130
  192. Profit96(6) = 19640
  193. Profit96(7) = 22150
  194. Profit96(8) = 21500
  195. Profit96(9) = 23460
  196. Profit96(10) = 22430
  197. Profit96(11) = 20190
  198. Profit96(12) = 19700
  199. Profit97(1) = 22250
  200. Profit97(2) = 22240
  201. Profit97(3) = 18160
  202. Profit97(4) = 18940
  203. Profit97(5) = 19500
  204. Profit97(6) = 22440
  205. Profit97(7) = 23650
  206. Profit97(8) = 22310
  207. Profit97(9) = 18140
  208. Profit97(10) = 20050
  209. Profit97(11) = 20160
  210. Profit97(12) = 21400
  211. Dim irow As Integer
  212. Grid.Clear
  213. For irow = 1 To 12
  214.     Grid.TextMatrix(irow, 1) = Format$(Profit97(irow), "#,###")
  215.     Grid.TextMatrix(irow, 2) = Format$(Profit96(irow), "#,###")
  216.     Grid.TextMatrix(irow, 3) = Format$(Grid.TextMatrix(irow, 2) - Grid.TextMatrix(irow, 1), "#,###")
  217.     Grid.TextMatrix(irow, 4) = Format$(100 * (Grid.TextMatrix(irow, 2) - Grid.TextMatrix(irow, 1)) / Grid.TextMatrix(irow, 1), "#.##") & "%"
  218.     Grid.FormatString = " |>  1996 Profit  |>  1997 Profit  |>  Gain   |>  Gain (%)  ;|  January   |  February   |  March   |  April   |  May   |  June   |  July   |  August   |  September   |  October   |  November   |  December   "
  219. ' Make title row bold
  220.     Grid.FillStyle = flexFillRepeat
  221.     Grid.Row = 0
  222.     Grid.ColSel = Grid.Cols - 1
  223.     Grid.CellFontBold = True
  224.     Grid.FillStyle = flexFillSingle
  225. ' Make title column bold
  226.     Grid.FillStyle = flexFillRepeat
  227.     Grid.Col = 0
  228.     Grid.RowSel = Grid.Rows - 1
  229.     Grid.CellFontBold = True
  230.     Grid.FillStyle = flexFillSingle
  231.     Grid.Row = 1
  232.     Grid.ColSel = 1
  233. End Sub
  234.