FrmFont.frm

 VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form FrmFont
   Caption         =   "Form1"
   ClientHeight    =   1905
   ClientLeft      =   2265
   ClientTop       =   1935
   ClientWidth     =   6255
   LinkTopic       =   "Form1"
   ScaleHeight     =   1905
   ScaleWidth      =   6255
   Begin VB.Frame fraSet
      Caption         =   "Title"
      BeginProperty Font
         Name            =   "Traditional Arabic"
         Size            =   12
         Charset         =   178
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   885
      Index           =   0
      Left            =   1200
      TabIndex        =   6
      Top             =   0
      Width           =   4980
      Begin VB.TextBox lblcurrfont
         Height          =   345
         Index           =   0
         Left            =   1290
         TabIndex        =   8
         Text            =   " "
         Top             =   390
         Width           =   3075
      End
      Begin VB.CommandButton cmdfont
         Caption         =   "Font ..."
         BeginProperty Font
            Name            =   "Traditional Arabic"
            Size            =   12
            Charset         =   178
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Index           =   0
         Left            =   90
         RightToLeft     =   -1  'True
         TabIndex        =   7
         Top             =   390
         Width           =   1080
      End
   End
   Begin VB.Frame fraSet
      Caption         =   "Details"
      BeginProperty Font
         Name            =   "Traditional Arabic"
         Size            =   12
         Charset         =   178
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   885
      Index           =   1
      Left            =   1200
      TabIndex        =   1
      Top             =   915
      Width           =   5010
      Begin VB.TextBox lblcurrfont
         Height          =   345
         Index           =   1
         Left            =   1290
         TabIndex        =   5
         Text            =   " "
         Top             =   390
         Width           =   3165
      End
      Begin VB.CommandButton cmdfont
         Caption         =   "Font..."
         BeginProperty Font
            Name            =   "Arabic Transparent"
            Size            =   9.75
            Charset         =   178
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   345
         Index           =   1
         Left            =   75
         RightToLeft     =   -1  'True
         TabIndex        =   4
         Top             =   375
         Width           =   1080
      End
      Begin VB.CheckBox chkAllowed
         Caption         =   "Allow in-cell editing"
         Height          =   210
         Left            =   435
         TabIndex        =   3
         Top             =   660
         Visible         =   0   'False
         Width           =   1890
      End
      Begin VB.CheckBox chknewrow
         Caption         =   "Show ""new item"" row"
         Height          =   210
         Left            =   165
         TabIndex        =   2
         Top             =   180
         Visible         =   0   'False
         Width           =   1890
      End
   End
   Begin VB.CommandButton cmdOK
      Caption         =   "OK"
      Height          =   450
      Left            =   30
      TabIndex        =   0
      Top             =   660
      Width           =   1080
   End
   Begin MSComDlg.CommonDialog cdlFont
      Left            =   6480
      Top             =   2505
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
End
Attribute VB_Name = "FrmFont"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim m_OK As Boolean
Dim f(0 To 1) As Font
Dim m_Changed As Boolean
Dim m_Colors(0 To 1) As Long


Private Sub cmdfont_Click(Index As Integer)
cdlFont.CancelError = True
'  On Error GoTo cmdFont_exit
  On Error Resume Next
    With cdlFont
        .FontBold = f(Index).Bold
        .FontItalic = f(Index).Italic
        .FontName = f(Index).Name
        .FontSize = f(Index).Size
        .FontStrikethru = f(Index).Strikethrough
        .FontUnderline = f(Index).Underline
        .Color = m_Colors(Index)
        .Flags = cdlCFEffects Or cdlCFForceFontExist Or cdlCFScreenFonts
        .ShowFont
        f(Index).Bold = .FontBold
        f(Index).Italic = .FontItalic
        f(Index).Name = .FontName
        f(Index).Size = .FontSize
        f(Index).Strikethrough = .FontStrikethru
        f(Index).Underline = .FontUnderline
        m_Colors(Index) = .Color
        SetFontCaptions
        m_Changed = True
    End With
End Sub
Private Sub SetFontCaptions()
Dim i As Integer

    For i = 0 To 1
        With f(i)
            lblcurrfont(i).FontBold = .Bold
            lblcurrfont(i).FontItalic = .Italic
            lblcurrfont(i).FontName = .Name
            lblcurrfont(i).FontStrikethru = .Strikethrough
            lblcurrfont(i).FontUnderline = .Underline
            lblcurrfont(i).Text = CInt(f(i).Size) & " pt. " & f(i).Name
        End With
        lblcurrfont(i).ForeColor = m_Colors(i)
    Next
End Sub
Public Sub FormatGrid(gr As DataGrid)
Dim i As Long

    m_OK = False
    Set f(0) = gr.HeadFont
    Set f(1) = gr.Font

    SetFontCaptions
 
    Show 1
    If m_OK Then
        Set gr.HeadFont = f(0)
        Set gr.Font = f(1)
   
        End If
 
    Unload Me
End Sub
Private Sub CmdOk_Click()
    m_OK = True
    Hide
End Sub

Project Homepage: