home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / gridex / frmtable.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-01-03  |  8.1 KB  |  257 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmTableview 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Format Table View"
  6.    ClientHeight    =   3090
  7.    ClientLeft      =   930
  8.    ClientTop       =   2070
  9.    ClientWidth     =   7185
  10.    BeginProperty Font 
  11.       Name            =   "Tahoma"
  12.       Size            =   8.25
  13.       Charset         =   0
  14.       Weight          =   400
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    Icon            =   "frmTableview.frx":0000
  20.    LinkTopic       =   "Form1"
  21.    MaxButton       =   0   'False
  22.    MinButton       =   0   'False
  23.    ScaleHeight     =   3090
  24.    ScaleWidth      =   7185
  25.    ShowInTaskbar   =   0   'False
  26.    StartUpPosition =   2  'CenterScreen
  27.    Begin MSComDlg.CommonDialog cdlFont 
  28.       Left            =   6630
  29.       Top             =   2790
  30.       _ExtentX        =   847
  31.       _ExtentY        =   847
  32.       _Version        =   327681
  33.    End
  34.    Begin VB.CommandButton cmdCancel 
  35.       Caption         =   "Cancel"
  36.       Height          =   375
  37.       Left            =   6060
  38.       TabIndex        =   13
  39.       Top             =   630
  40.       Width           =   1035
  41.    End
  42.    Begin VB.CommandButton cmdOK 
  43.       Caption         =   "OK"
  44.       Height          =   330
  45.       Left            =   6075
  46.       TabIndex        =   12
  47.       Top             =   240
  48.       Width           =   1020
  49.    End
  50.    Begin VB.Frame fraSet 
  51.       Caption         =   "Grid Lines"
  52.       Height          =   765
  53.       Index           =   2
  54.       Left            =   120
  55.       TabIndex        =   2
  56.       Top             =   2145
  57.       Width           =   5700
  58.       Begin VB.ComboBox cboGridlines 
  59.          Height          =   315
  60.          ItemData        =   "frmTableview.frx":000C
  61.          Left            =   1470
  62.          List            =   "frmTableview.frx":0017
  63.          Style           =   2  'Dropdown List
  64.          TabIndex        =   11
  65.          Top             =   210
  66.          Width           =   1830
  67.       End
  68.       Begin VB.CheckBox chkgrouphead 
  69.          Caption         =   "Shade group headings"
  70.          Height          =   210
  71.          Left            =   3480
  72.          TabIndex        =   10
  73.          Top             =   270
  74.          Value           =   1  'Checked
  75.          Width           =   1965
  76.       End
  77.       Begin VB.Label lblGridlines 
  78.          Caption         =   "Grid line style:"
  79.          Height          =   285
  80.          Index           =   0
  81.          Left            =   180
  82.          TabIndex        =   9
  83.          Top             =   315
  84.          Width           =   2325
  85.       End
  86.    End
  87.    Begin VB.Frame fraSet 
  88.       Caption         =   "Rows"
  89.       Height          =   885
  90.       Index           =   1
  91.       Left            =   120
  92.       TabIndex        =   1
  93.       Top             =   1125
  94.       Width           =   5700
  95.       Begin VB.CheckBox chknewrow 
  96.          Caption         =   "Show ""new item"" row"
  97.          Height          =   210
  98.          Left            =   3465
  99.          TabIndex        =   8
  100.          Top             =   585
  101.          Width           =   1890
  102.       End
  103.       Begin VB.CheckBox chkAllowed 
  104.          Caption         =   "Allow in-cell editing"
  105.          Height          =   210
  106.          Left            =   3465
  107.          TabIndex        =   7
  108.          Top             =   255
  109.          Value           =   1  'Checked
  110.          Width           =   1890
  111.       End
  112.       Begin VB.CommandButton cmdfont 
  113.          Caption         =   "Font..."
  114.          Height          =   345
  115.          Index           =   1
  116.          Left            =   225
  117.          TabIndex        =   4
  118.          Top             =   330
  119.          Width           =   1080
  120.       End
  121.       Begin VB.Label lblcurrfont 
  122.          BorderStyle     =   1  'Fixed Single
  123.          Caption         =   "Current font"
  124.          Height          =   285
  125.          Index           =   1
  126.          Left            =   1470
  127.          TabIndex        =   6
  128.          Top             =   345
  129.          Width           =   1845
  130.       End
  131.    End
  132.    Begin VB.Frame fraSet 
  133.       Caption         =   "Column headings"
  134.       Height          =   885
  135.       Index           =   0
  136.       Left            =   120
  137.       TabIndex        =   0
  138.       Top             =   120
  139.       Width           =   5700
  140.       Begin VB.CommandButton cmdfont 
  141.          Caption         =   "Font..."
  142.          Height          =   345
  143.          Index           =   0
  144.          Left            =   210
  145.          TabIndex        =   3
  146.          Top             =   345
  147.          Width           =   1080
  148.       End
  149.       Begin VB.Label lblcurrfont 
  150.          BorderStyle     =   1  'Fixed Single
  151.          Caption         =   "Current font"
  152.          Height          =   285
  153.          Index           =   0
  154.          Left            =   1455
  155.          TabIndex        =   5
  156.          Top             =   360
  157.          Width           =   1845
  158.       End
  159.    End
  160. Attribute VB_Name = "frmTableview"
  161. Attribute VB_GlobalNameSpace = False
  162. Attribute VB_Creatable = False
  163. Attribute VB_PredeclaredId = True
  164. Attribute VB_Exposed = False
  165. Option Explicit
  166. Dim m_OK As Boolean
  167. Dim f(0 To 1) As Font
  168. Dim m_Changed As Boolean
  169. Dim m_Colors(0 To 1) As Long
  170. Public Sub FormatGrid(gr As GridEX)
  171.     m_OK = False
  172.     Set f(0) = gr.ColumnHeaderFont
  173.     Set f(1) = gr.Font
  174.     m_Colors(0) = gr.ForeColorHeader
  175.     m_Colors(1) = gr.ForeColor
  176.     SetFontCaptions
  177.     chknewrow.Value = IIf(gr.AllowAddNew, vbChecked, vbUnchecked)
  178.     chkAllowed.Value = IIf(gr.AllowEdit, vbChecked, vbUnchecked)
  179.     If gr.GridLines Then
  180.         cboGridlines.ListIndex = 0
  181.     Else
  182.         cboGridlines.ListIndex = 1
  183.     End If
  184.     If gr.BackColorRowGroup = vbButtonFace Then
  185.         chkgrouphead.Value = vbChecked
  186.     Else
  187.         chkgrouphead.Value = vbUnchecked
  188.     End If
  189.     Show 1
  190.     If m_OK Then
  191.         Set gr.ColumnHeaderFont = f(0)
  192.         Set gr.Font = f(1)
  193.         gr.ForeColorHeader = m_Colors(0)
  194.         gr.ForeColor = m_Colors(1)
  195.         gr.AllowEdit = (chkAllowed.Value = vbChecked)
  196.         frmMain.AllowAddNew (chknewrow.Value = vbChecked)
  197.         gr.GridLines = cboGridlines.ItemData(cboGridlines.ListIndex)
  198.         gr.BackColorRowGroup = IIf(chkgrouphead.Value = vbChecked, vbButtonFace, vbWindowBackground)
  199.     End If
  200.     Unload Me
  201. End Sub
  202. Private Sub SetFontCaptions()
  203. Dim i As Integer
  204.     For i = 0 To 1
  205.         With f(i)
  206.             lblcurrfont(i).FontBold = .Bold
  207.             lblcurrfont(i).FontItalic = .Italic
  208.             lblcurrfont(i).FontName = .Name
  209.             lblcurrfont(i).FontStrikethru = .Strikethrough
  210.             lblcurrfont(i).FontUnderline = .Underline
  211.             lblcurrfont(i).Caption = CInt(f(i).Size) & " pt. " & f(i).Name
  212.         End With
  213.         lblcurrfont(i).ForeColor = m_Colors(i)
  214.     Next
  215. End Sub
  216. Private Sub cmdCancel_Click()
  217.     Hide
  218. End Sub
  219. Private Sub cmdfont_Click(Index As Integer)
  220.     cdlFont.CancelError = True
  221.     On Error GoTo cmdFont_exit
  222.     With cdlFont
  223.         .FontBold = f(Index).Bold
  224.         .FontItalic = f(Index).Italic
  225.         .FontName = f(Index).Name
  226.         .FontSize = f(Index).Size
  227.         .FontStrikethru = f(Index).Strikethrough
  228.         .FontUnderline = f(Index).Underline
  229.         .Color = m_Colors(Index)
  230.         .Flags = cdlCFEffects Or cdlCFForceFontExist Or cdlCFScreenFonts
  231.         .ShowFont
  232.         f(Index).Bold = .FontBold
  233.         f(Index).Italic = .FontItalic
  234.         f(Index).Name = .FontName
  235.         f(Index).Size = .FontSize
  236.         f(Index).Strikethrough = .FontStrikethru
  237.         f(Index).Underline = .FontUnderline
  238.         m_Colors(Index) = .Color
  239.         SetFontCaptions
  240.         m_Changed = True
  241.     End With
  242. cmdFont_exit:
  243.     Exit Sub
  244. End Sub
  245. Private Sub cmdOK_Click()
  246.     m_OK = True
  247.     Hide
  248. End Sub
  249. Private Sub chkAllowed_Click()
  250.     If chkAllowed.Value = vbChecked Then
  251.         chknewrow.Enabled = True
  252.     Else
  253.         chknewrow.Enabled = False
  254.         chknewrow.Value = vbUnchecked
  255.     End If
  256. End Sub
  257.