예제 #1
0
        private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            e.Layout.Bands[1].Columns["size"].SortComparer = new SizeComparer();
            e.Layout.Bands[1].Columns["size"].SortIndicator = SortIndicator.Ascending;
            //this.ultraGrid1.Rows[0].Height = 25;

            e.Layout.Override.SelectTypeRow = SelectType.Single;
            e.Layout.Override.CellClickAction = CellClickAction.RowSelect;
            //列名
            e.Layout.Bands[0].Columns["cartonNumber"].Header.Caption = "箱号";

            // e.Layout.Bands[0].Columns["cartonNumber"].Layout.Override.DefaultColWidth = 60;
            e.Layout.Bands[0].Columns["qty"].Header.Caption = "开箱双数";
            e.Layout.Bands[0].Columns["qty2"].Header.Caption = "封箱双数";
            e.Layout.Bands[0].Columns["valid"].Header.Caption = "满箱";
            e.Layout.Bands[0].Columns["status"].Header.Caption = "状态";

            //   e.Layout.Bands[0].Columns["valid"].Header.Caption = "是否满箱";
            e.Layout.Bands[1].Columns["cartonNumber"].Header.Caption = "箱号";
            e.Layout.Bands[1].Columns["type"].Header.Caption = "款号";
            e.Layout.Bands[1].Columns["color"].Header.Caption = "颜色";
            e.Layout.Bands[1].Columns["size"].Header.Caption = "尺码";
            e.Layout.Bands[1].Columns["qty"].Header.Caption = "开箱双数";
            e.Layout.Bands[1].Columns["qty2"].Header.Caption = "封箱双数";
            e.Layout.Appearance.FontData.SizeInPoints = 12;
            e.Layout.Appearance.TextVAlign = VAlign.Middle;
            //  grid.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
            ConditionValueAppearance cva = new ConditionValueAppearance();
            OperatorCondition oc = new OperatorCondition(ConditionOperator.Contains, "未保存");
            Infragistics.Win.Appearance apce1 = new Infragistics.Win.Appearance("apce1");
            apce1.ForeColor = Color.Red;
            apce1.BackColor = Color.Yellow;
            cva.Add(oc, apce1);
            e.Layout.Bands[0].Columns["status"].ValueBasedAppearance = cva;

            ConditionValueAppearance cva2 = new ConditionValueAppearance();
            OperatorCondition oc2 = new OperatorCondition(ConditionOperator.Contains, "否");
            Infragistics.Win.Appearance apce2 = new Infragistics.Win.Appearance("apce2");
            apce2.ForeColor = Color.Red;
            apce2.BackColor = Color.Yellow;
            cva2.Add(oc2, apce2);
            e.Layout.Bands[0].Columns["valid"].ValueBasedAppearance = cva2;
        }
예제 #2
0
    private ConditionValueAppearance CreateOperatorConditionValueAppearance()
    {
      // This method will create a ConditionValueAppearance using OperatorConditions. OperatorConditions
      // do not rely on UltraCalcManager and they cannot use formulas. They need a ConditionOperator
      // and a value to determine if the cell matches the condition. 

      // Create a new ConditionValueAppearance
      var conditionValueAppearance = new ConditionValueAppearance();

      // Create a OperatorCondition that checks for negative numbers
      var negativeCondition = new OperatorCondition(ConditionOperator.LessThan, 0);

      // Create an appearance that sets the ForeColor to red.
      var negativeAppearance = new Infragistics.Win.Appearance("Negative")
      {
        ForeColor = LookFeel.NegativeColor
      };

      // Create a OperatorCondition that checks for positive numbers
      var positiveCondition = new OperatorCondition(ConditionOperator.GreaterThanOrEqualTo, 0);

      // Create an appearance that sets the ForeColor to blue.
      var positiveAppearance = new Infragistics.Win.Appearance("Positive")
      {
        ForeColor = LookFeel.PositiveColor
      };

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

      return conditionValueAppearance;
    }