Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #14885 |

    We are new at xCeed and are using the grid control for the first time. I can not figure out how to make a cell’s font bold, or the whole row if necessary.

    I have not tested any of my code yet, so maybe it’s all wrong 🙂 but this is what I am doing

    My grid columns are defined in the IDE.
    I add a row to the grid like this:
    Dim row As Xceed.Grid.DataRow = GridMain.DataRows.AddNew
    I set cell values and backcolor like this:
    Dim cell As Xceed.Grid.DataCell
    For Each cell In row.Cells
    Select Case cell.FieldName
    Case “Extended”
    If oTable.lineExtended = True Then
    cell.Value = “*”
    cell.Value = “”
    End If
    cell.BackColor = Color.FromArgb(oTable.c1)
    Case “Supplier”
    cell.Value = oTable.vendor
    cell.BackColor = Color.FromArgb(oTable.c2)
    Case “IDate”
    cell.Value = oTable.DateSold
    cell.BackColor = Color.FromArgb(oTable.c3)

    End Select

    Now, if there is a certain indicator present, only known via code, I need to make the row I just added “bold”


    Imported from legacy forums. Posted by Gary (had 2129 views)

    User (Old forums)
    Post count: 23064

    You need to set the Font property of the cell or the row. However, all properties on a System.Drawing.Font are ReadOnly, so when you want to change an attribute on a font, you need to create a new one and pass it to the Font property.


    cell.Font = new Font( cell.Font.FontFamily, cell.Font.Size, FontStyle.Bold );
    row.Font = new Font( row.Font.FontFamily, row.Font.Size, FontStyle.Bold );

    Of course you can define a whole new font (e.g. cell.Font = new Font( “Arial”, 10, FontStyle.Bold );), but you likely want to keep the exact same font, and only make it bold.

    Imported from legacy forums. Posted by André (had 2965 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.