'宣言 Public Function New( _ ByVal condition As ICondition _ )
public ComplementCondition( ICondition condition )
Imports Infragistics.Win Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) ' Create a new ConditionValueAppearance Dim conditionValueAppearance As ConditionValueAppearance = New ConditionValueAppearance() ' Create a ComplementCondition that checks for negative numbers Dim negativeCondition As OperatorCondition = New OperatorCondition(ConditionOperator.LessThan,0) ' Create an appearance that sets the ForeColor to red. Dim negativeAppearance As Infragistics.Win.Appearance = New Infragistics.Win.Appearance("Negative") negativeAppearance.ForeColor = Color.Red ' Create a ComplementCondition that checks for anything that does not meet the ' negativeCondition Dim positiveCondition As ComplementCondition = New ComplementCondition(negativeCondition) ' Create an appearance that sets the ForeColor to blue. Dim positiveAppearance As Infragistics.Win.Appearance = New Infragistics.Win.Appearance("Positive") positiveAppearance.ForeColor = Color.Blue ' Now that we have the conditions and appearances we need, add them to the ' conditionValueAppearance. The conditions will be evaluated in order. conditionValueAppearance.Add(negativeCondition, negativeAppearance) conditionValueAppearance.Add(positiveCondition, positiveAppearance) End Sub
using Infragistics.Win; private void button1_Click(object sender, EventArgs e) { // Create a new ConditionValueAppearance ConditionValueAppearance conditionValueAppearance = new ConditionValueAppearance(); // Create a ComplementCondition that checks for negative numbers OperatorCondition negativeCondition = new OperatorCondition(ConditionOperator.LessThan, 0); // Create an appearance that sets the ForeColor to red. Infragistics.Win.Appearance negativeAppearance = new Infragistics.Win.Appearance("Negative"); negativeAppearance.ForeColor = Color.Red; // Create a ComplementCondition that checks for anything that does not meet the // negativeCondition ComplementCondition positiveCondition = new ComplementCondition(negativeCondition); // Create an appearance that sets the ForeColor to blue. Infragistics.Win.Appearance positiveAppearance = new Infragistics.Win.Appearance("Positive"); positiveAppearance.ForeColor = Color.Blue; // Now that we have the conditions and appearances we need, add them to the // conditionValueAppearance. The conditions will be evaluated in order. conditionValueAppearance.Add(negativeCondition, negativeAppearance); conditionValueAppearance.Add(positiveCondition, positiveAppearance); }