user2579548
user2579548

Reputation:

How to style C1FlexGrid for FontBold with VB.Net

How to make a rows or Column in C1flexgrid has a bold format font??

I mean, I have a coding like this:

Com_B1B2.Parameters("Param1").Value = gDate2
Com_B1B2.ParameterCheck = True

OraDA = New OracleDataAdapter(Com_B1B2)
OraDA.Fill(OraDT)

VLX_B1B2.DataSource = OraDT

VLX_B1B2.Cols(0).Width = 0

Can anyone help?

Upvotes: 0

Views: 3362

Answers (3)

H_G
H_G

Reputation: 357

I think it's better to define the style just one time, instead of copying it in every row:

Dim cs As C1.Win.C1FlexGrid.CellStyle = grid.Styles.Add("FontBold")
cs.Font = New Font(grid.Font.Name, grid.Font.Size, FontStyle.Bold)
'to get styles elsewhere (after created once): grid.styles("FontBold")
grid.SetCellStyle(3, 4, "FontBold") 'set just one cell
grid.Cols(6).Style = cs 'set complete column
grid.Rows(6).Style = cs 'set complete row

Upvotes: 0

Nilay Vishwakarma
Nilay Vishwakarma

Reputation: 3363

To make any row/column's font bold you may use the following snippet:

void MakeColumnBold(int ColNo, C1FlexGrid grid)
{
  CellStyle cs = grid.Cols[ColNo].StyleNew;
  cs.Font = new Font(grid.Font.Name, grid.Font.Size, FontStyle.Bold);
}

void MakeRowBold(int RowNo, C1FlexGrid grid)
{
  CellStyle cs = grid.Rows[RowNo].StyleNew;
  cs.Font = new Font(grid.Font.Name, grid.Font.Size, FontStyle.Bold);
}

Upvotes: 2

Mohita
Mohita

Reputation: 499

You can handle the OwnerDrawCell event of the C1Flexgrid and then assign different fontstyle to the desired row/column.

For complete implementation, please refer to this blog post.

Regards, Mohita

Upvotes: 2

Related Questions