【问题标题】:How to style C1FlexGrid for FontBold with VB.Net如何使用 VB.Net 为 FontBold 设置 C1FlexGrid 样式
【发布时间】:2016-10-12 04:01:40
【问题描述】:

如何使C1flexgrid中的行或列具有粗体格式字体??

我的意思是,我有这样的编码:

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

谁能帮忙?

【问题讨论】:

    标签: vb.net c1flexgrid


    【解决方案1】:

    您可以处理 C1Flexgrid 的OwnerDrawCell 事件,然后为所需的行/列分配不同的字体样式。

    完整实现请参考this博文。

    问候, 莫希塔

    【讨论】:

      【解决方案2】:

      要使任何行/列的字体加粗,您可以使用以下 sn-p:

      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);
      }
      

      【讨论】:

        【解决方案3】:

        我认为最好只定义一次样式,而不是在每一行中复制它:

        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
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-10-30
          • 2011-07-19
          • 2019-05-31
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多