|
-
Jul 10th, 2007, 02:48 AM
#1
Thread Starter
PowerPoster
[RESOLVED] MSFlexgrid Font Issue
Hi All,
Is it possible to make different columns in an MSFlexgrid set to different font styles. I want for example Column 1 to be the font type "Marlett" and Column 2 to be of the font type "Arial".
Please help.
Thanks.
-
Jul 10th, 2007, 04:50 AM
#2
Re: MSFlexgrid Font Issue
I think you can use sendmessage with WM_SETFONT
http://msdn2.microsoft.com/en-us/library/ms632642.aspx
SendMessage m_hWnd, WM_SETFONT, m_hFnt, 1
Last edited by Fazi; Jul 10th, 2007 at 04:57 AM.
-
Jul 10th, 2007, 05:41 AM
#3
Re: MSFlexgrid Font Issue
Play around with this:
Code:
Private Sub Command1_Click()
setColumnFont MSFlexGrid1, True, 2, "Arial", 10, True, False, False, False
setColumnFont MSFlexGrid1, False, 4, "Marlett", 12, False, True, True, False
End Sub
Sub setColumnFont(mfg As MSFlexGrid, _
withHeader As Boolean, _
column As Integer, _
fontName As String, _
fontSize As Integer, _
fontBold As Boolean, _
fontItalic As Boolean, _
fontUnderline As Boolean, _
fontStrikeThrough As Boolean)
Dim intI As Integer
Dim intStart As Integer, intEnd As Integer
Dim intRow As Integer, intRowSel As Integer, intCol As Integer, intColSel As Integer
With mfg
.Visible = False
intRow = .Row
intRowSel = .RowSel
intCol = .Col
intColSel = .ColSel
.Col = (column - 1)
If withHeader Then
intStart = 0
intEnd = (.Rows - 1)
Else
intStart = .FixedRows
intEnd = (.Rows - intEnd - 1)
End If
For intI = intStart To intEnd
.Row = intI
.CellFontName = fontName
.CellFontSize = fontSize
.CellFontBold = fontBold
.CellFontItalic = fontItalic
.CellFontUnderline = fontUnderline
.CellFontStrikeThrough = fontStrikeThrough
Next intI
.Row = intRow
.RowSel = intRowSel
.Col = intCol
.ColSel = intColSel
.Visible = True
End With
End Sub
-
Jul 10th, 2007, 06:59 AM
#4
Thread Starter
PowerPoster
Re: MSFlexgrid Font Issue
 Originally Posted by gavio
Play around with this:
Code:
Private Sub Command1_Click()
setColumnFont MSFlexGrid1, True, 2, "Arial", 10, True, False, False, False
setColumnFont MSFlexGrid1, False, 4, "Marlett", 12, False, True, True, False
End Sub
Sub setColumnFont(mfg As MSFlexGrid, _
withHeader As Boolean, _
column As Integer, _
fontName As String, _
fontSize As Integer, _
fontBold As Boolean, _
fontItalic As Boolean, _
fontUnderline As Boolean, _
fontStrikeThrough As Boolean)
Dim intI As Integer
Dim intStart As Integer, intEnd As Integer
Dim intRow As Integer, intRowSel As Integer, intCol As Integer, intColSel As Integer
With mfg
.Visible = False
intRow = .Row
intRowSel = .RowSel
intCol = .Col
intColSel = .ColSel
.Col = (column - 1)
If withHeader Then
intStart = 0
intEnd = (.Rows - 1)
Else
intStart = .FixedRows
intEnd = (.Rows - intEnd - 1)
End If
For intI = intStart To intEnd
.Row = intI
.CellFontName = fontName
.CellFontSize = fontSize
.CellFontBold = fontBold
.CellFontItalic = fontItalic
.CellFontUnderline = fontUnderline
.CellFontStrikeThrough = fontStrikeThrough
Next intI
.Row = intRow
.RowSel = intRowSel
.Col = intCol
.ColSel = intColSel
.Visible = True
End With
End Sub
Wow,
Thanks alot Gavio. It's working perfectly.
-
Jul 10th, 2007, 07:37 AM
#5
Re: [RESOLVED] MSFlexgrid Font Issue
No prob!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|