Link to home
Start Free TrialLog in
Avatar of ariell
ariell

asked on

Underline the first letter

I have a flexgrid.
And i want to display a word in the flex that only the first letter will have an underline.
Or to mark the first letter with different color.

I will thank if anyone can have a solution for me.
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

ariell, this is unfortunately not possible with the flexgrid. You do not have much control over individual characters within the flexgrid cells. The following code simulates the underlining of the first character of each cell in a column by setting a cellpicture to contain a single line the approximate width of the first character.

Private Sub Command1_Click()
    With Picture1
        For intRow = 1 To MSFlexGrid1.Rows - 1
            .Width = MSFlexGrid1.ColWidth(1)
            .Height = MSFlexGrid1.RowHeight(intRow) + 50
            .Cls
            .AutoRedraw = True
            MSFlexGrid1.Row = intRow
            MSFlexGrid1.Col = 1
            .BackColor = MSFlexGrid1.BackColor
            .FontSize = MSFlexGrid1.CellFontSize
            .FontName = MSFlexGrid1.CellFontName
            Picture1.Line (5, .ScaleHeight - 2)-(.TextWidth(Left(MSFlexGrid1.TextMatrix(intRow, 1), 1)), .ScaleHeight), vbBlack, BF
            Set MSFlexGrid1.CellPicture = Picture1.Image
        Next
    End With
End Sub

Private Sub Form_Load()
    With MSFlexGrid1
        For intRow = 1 To .Rows - 1
            .TextMatrix(intRow, 1) = "Hello"
            .Col = 1
            .Row = intRow
            .CellFontSize = 5 + intRow
            Me.FontSize = .CellFontSize
            .RowHeight(intRow) = Me.TextHeight(.TextMatrix(intRow, 1))
            .ColWidth(1) = Me.TextWidth(.TextMatrix(intRow, 1))
        Next
    End With
End Sub
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ariell
ariell

ASKER

It was an old question, i forgot about it.
Thank for your reminder.
ariell,
Too late now, but in the future, please accept one of the comments made by one of the Experts who helped you (not me). Thanks! --Dan
TimCottee

I will post a separate question for you in his TA.

** Mindphaser - Community Support Moderator **