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.
Printable View
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.
I think you can use sendmessage with WM_SETFONT
http://msdn2.microsoft.com/en-us/library/ms632642.aspx
Quote:
SendMessage m_hWnd, WM_SETFONT, m_hFnt, 1
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,Quote:
Originally Posted by gavio
Thanks alot Gavio. It's working perfectly.
No prob! :thumb: