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

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmCardView 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Format Card View"
  6.    ClientHeight    =   2940
  7.    ClientLeft      =   690
  8.    ClientTop       =   1650
  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            =   "frmCardview.frx":0000
  20.    LinkTopic       =   "Form1"
  21.    MaxButton       =   0   'False
  22.    MinButton       =   0   'False
  23.    ScaleHeight     =   2940
  24.    ScaleWidth      =   7185
  25.    ShowInTaskbar   =   0   'False
  26.    StartUpPosition =   2  'CenterScreen
  27.    Begin MSComDlg.CommonDialog cdlFont 
  28.       Left            =   6615
  29.       Top             =   2355
  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        =   10
  39.       Top             =   630
  40.       Width           =   1035
  41.    End
  42.    Begin VB.CommandButton cmdOK 
  43.       Caption         =   "OK"
  44.       Height          =   330
  45.       Left            =   6075
  46.       TabIndex        =   9
  47.       Top             =   240
  48.       Width           =   1020
  49.    End
  50.    Begin VB.Frame fraSet 
  51.       Caption         =   "Card settings"
  52.       Height          =   675
  53.       Index           =   2
  54.       Left            =   120
  55.       TabIndex        =   2
  56.       Top             =   2145
  57.       Width           =   5700
  58.       Begin VB.TextBox txtCardWidth 
  59.          Height          =   330
  60.          Left            =   1125
  61.          TabIndex        =   11
  62.          Top             =   240
  63.          Width           =   1020
  64.       End
  65.       Begin VB.Label lblGridlines 
  66.          Caption         =   "pixels"
  67.          Height          =   285
  68.          Index           =   1
  69.          Left            =   2220
  70.          TabIndex        =   12
  71.          Top             =   285
  72.          Width           =   1080
  73.       End
  74.       Begin VB.Label lblGridlines 
  75.          Caption         =   "Card width:"
  76.          Height          =   285
  77.          Index           =   0
  78.          Left            =   150
  79.          TabIndex        =   8
  80.          Top             =   300
  81.          Width           =   1080
  82.       End
  83.    End
  84.    Begin VB.Frame fraSet 
  85.       Caption         =   "Card body"
  86.       Height          =   885
  87.       Index           =   1
  88.       Left            =   120
  89.       TabIndex        =   1
  90.       Top             =   1125
  91.       Width           =   5700
  92.       Begin VB.CheckBox chkAllowed 
  93.          Caption         =   "Allow in-cell editing"
  94.          Height          =   210
  95.          Left            =   3465
  96.          TabIndex        =   7
  97.          Top             =   255
  98.          Value           =   1  'Checked
  99.          Width           =   1890
  100.       End
  101.       Begin VB.CommandButton cmdfont 
  102.          Caption         =   "Font..."
  103.          Height          =   345
  104.          Index           =   1
  105.          Left            =   225
  106.          TabIndex        =   4
  107.          Top             =   330
  108.          Width           =   1080
  109.       End
  110.       Begin VB.Label lblcurrfont 
  111.          BorderStyle     =   1  'Fixed Single
  112.          Caption         =   "Current font"
  113.          Height          =   285
  114.          Index           =   1
  115.          Left            =   1470
  116.          TabIndex        =   6
  117.          Top             =   345
  118.          Width           =   1845
  119.       End
  120.    End
  121.    Begin VB.Frame fraSet 
  122.       Caption         =   "Card headings"
  123.       Height          =   885
  124.       Index           =   0
  125.       Left            =   120
  126.       TabIndex        =   0
  127.       Top             =   120
  128.       Width           =   5700
  129.       Begin VB.CommandButton cmdfont 
  130.          Caption         =   "Font..."
  131.          Height          =   345
  132.          Index           =   0
  133.          Left            =   210
  134.          TabIndex        =   3
  135.          Top             =   345
  136.          Width           =   1080
  137.       End
  138.       Begin VB.Label lblcurrfont 
  139.          BorderStyle     =   1  'Fixed Single
  140.          Caption         =   "Current font"
  141.          Height          =   285
  142.          Index           =   0
  143.          Left            =   1455
  144.          TabIndex        =   5
  145.          Top             =   360
  146.          Width           =   1845
  147.       End
  148.    End
  149. Attribute VB_Name = "frmCardView"
  150. Attribute VB_GlobalNameSpace = False
  151. Attribute VB_Creatable = False
  152. Attribute VB_PredeclaredId = True
  153. Attribute VB_Exposed = False
  154. Option Explicit
  155. Dim m_OK As Boolean
  156. Dim f(0 To 1) As Font
  157. Dim m_Changed As Boolean
  158. Dim m_Colors(0 To 1) As Long
  159. Const AllChars = "abcdefghijklmnopqrstuvwxyz"
  160. Public Sub FormatGrid(gr As GridEX)
  161.     m_OK = False
  162.     Set f(0) = gr.ColumnHeaderFont
  163.     Set f(1) = gr.Font
  164.     m_Colors(0) = gr.ForeColorHeader
  165.     m_Colors(1) = gr.ForeColor
  166.     SetFontCaptions
  167.     chkAllowed.Value = IIf(gr.AllowEdit, vbChecked, vbUnchecked)
  168.     Set Font = f(1)
  169.     Me.ScaleMode = vbTwips
  170.     txtCardWidth.Text = ScaleX(gr.CardWidth, vbTwips, vbPixels)
  171.     Show 1
  172.     If m_OK Then
  173.         Set gr.ColumnHeaderFont = f(0)
  174.         Set gr.Font = f(1)
  175.         gr.ForeColorHeader = m_Colors(0)
  176.         gr.ForeColor = m_Colors(1)
  177.         gr.AllowEdit = (chkAllowed.Value = vbChecked)
  178.         On Error Resume Next
  179.         gr.CardWidth = ScaleX(txtCardWidth.Text, vbPixels, vbTwips)
  180.     End If
  181.     Unload Me
  182. End Sub
  183. Private Sub SetFontCaptions()
  184. Dim i As Integer
  185.     For i = 0 To 1
  186.         With f(i)
  187.             lblcurrfont(i).FontBold = .Bold
  188.             lblcurrfont(i).FontItalic = .Italic
  189.             lblcurrfont(i).FontName = .Name
  190.             lblcurrfont(i).FontStrikethru = .Strikethrough
  191.             lblcurrfont(i).FontUnderline = .Underline
  192.             lblcurrfont(i).Caption = CInt(f(i).Size) & " pt. " & f(i).Name
  193.         End With
  194.         lblcurrfont(i).ForeColor = m_Colors(i)
  195.     Next
  196. End Sub
  197. Private Sub cmdCancel_Click()
  198.     Hide
  199. End Sub
  200. Private Sub cmdfont_Click(Index As Integer)
  201.     cdlFont.CancelError = True
  202.     On Error GoTo cmdFont_exit
  203.     With cdlFont
  204.         .FontBold = f(Index).Bold
  205.         .FontItalic = f(Index).Italic
  206.         .FontName = f(Index).Name
  207.         .FontSize = f(Index).Size
  208.         .FontStrikethru = f(Index).Strikethrough
  209.         .FontUnderline = f(Index).Underline
  210.         .Color = m_Colors(Index)
  211.         .Flags = cdlCFEffects Or cdlCFForceFontExist Or cdlCFScreenFonts
  212.         .ShowFont
  213.         f(Index).Bold = .FontBold
  214.         f(Index).Italic = .FontItalic
  215.         f(Index).Name = .FontName
  216.         f(Index).Size = .FontSize
  217.         f(Index).Strikethrough = .FontStrikethru
  218.         f(Index).Underline = .FontUnderline
  219.         m_Colors(Index) = .Color
  220.         SetFontCaptions
  221.         m_Changed = True
  222.     End With
  223. cmdFont_exit:
  224.     Exit Sub
  225. End Sub
  226. Private Sub cmdOK_Click()
  227.     m_OK = True
  228.     Hide
  229. End Sub
  230.