문제

I have a flexgrid (flex component grid), how do i hide a cell.

For ex: 2nd row and 5th column - i need to hide/remove based on some condition.

for say

if(C1FlexGrid1.Rows[2][5].ToString().Length <0)
{
  //I want this to be invisible.
  C1FlexGrid1.Rows[2][5].isVisible=false;
}

There is no propery that supports isVisible the way i have used. Any way i can achieve this ? Thanks.

도움이 되었습니까?

해결책

Finally i figured it out:

Create a ownerdrawcell event for your winforms component grid:

componentGrid.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw;
componentGrid.OwnerDrawCell += componentGrid_OwnerDrawCell;

Method

void componentGrid_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
{
       var value = componentGrid.GetCellCheck(e.Row,e.Col);
       //Your custom condition
       if (value is bool)
       {
          //Will hide the cell
          e.Style.Display = DisplayEnum.None;
       }
       else
       {
           //Will show the cell  
           e.Style.Display = DisplayEnum.Stack;
       }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top