• Using Conditional Formatting [Janus GridEX WinForms Control v3.5 for .NET]

    There could be situations where you want to apply different formats to rows or cells depending on a condition. You could use FormatConditions in GridEX control for this effect.

    1) A FormatCondition that uses StrikeOut font and gray ForeColor to indicate the user that the product is discontinued.



    2) A FormatCondition that uses Bold Font and red ForeColor to indicate the user that the product is on sale.



    The steps you need to add a FormatCondition is code are:



    1) Create a new GridEXFormatCondition object:



    In the following code we are creating a FormatCondition and then defining the FormatStyle settings that will be applied to all the rows where Discontinued column value is True.





    In VB:



    Dim fc As GridEXFormatCondition

    fc = New GridEXFormatCondition(GridEX1.RootTable.Columns("Discontinued"), ConditionOperator.Equal, True)

    In C#:

    GridEXFormatCondition fc = new GridEXFormatCondition(this.gridEX1.RootTable.Columns["Discontinued"],ConditionOperator.Equal,true);



    2) Specify the FormatStyle properties you want to be applied in the rows where the condition is met.



    fc.FormatStyle.FontStrikeout = TriState.True;

    fc.FormatStyle.ForeColor = SystemColors.GrayText;



    3) Add the FormatCondition created to the FormatCondition collection in the table.

    gridEX1.RootTable.FormatConditions.Add(fc);


    Source Of Information : Janus v3.5 Help Files for VS 2008


0 comments:

Leave a Reply