■ GridFormatRule 클래스에서 컬럼에 아이콘 세트 포맷을 적용하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
using DevExpress.XtraEditors; using DevExpress.XtraTreeList; using DevExpress.XtraTreeList.Columns; using DevExpress.XtraTreeList.StyleFormatConditions; ... private TreeList treeList; ... private TreeListColumn marchColumn; .. TreeListFormatRule treeListFormatRule = new TreeListFormatRule(); FormatConditionRuleIconSet formatConditionRuleIconSet = new FormatConditionRuleIconSet(); FormatConditionIconSet formatConditionIconSet = new FormatConditionIconSet(); formatConditionRuleIconSet.IconSet = formatConditionIconSet; FormatConditionIconSetIcon formatConditionIconSetIcon1 = new FormatConditionIconSetIcon(); FormatConditionIconSetIcon formatConditionIconSetIcon2 = new FormatConditionIconSetIcon(); FormatConditionIconSetIcon formatConditionIconSetIcon3 = new FormatConditionIconSetIcon(); FormatConditionIconSetIcon formatConditionIconSetIcon4 = new FormatConditionIconSetIcon(); // 기정의 아이콘들을 설정한다. formatConditionIconSetIcon1.PredefinedName = "Rating4_1.png"; formatConditionIconSetIcon2.PredefinedName = "Rating4_2.png"; formatConditionIconSetIcon3.PredefinedName = "Rating4_3.png"; formatConditionIconSetIcon4.PredefinedName = "Rating4_4.png"; // 한계 값들의 타입을 설정한다. formatConditionIconSet.ValueType = FormatConditionValueType.Number; // 한계 값들을 설정함으로써 아이콘들이 적용되는 범위들을 정의한다. formatConditionIconSetIcon1.Value = 75; // 타겟 범위 : 75 <= 값 formatConditionIconSetIcon1.ValueComparison = FormatConditionComparisonType.GreaterOrEqual; formatConditionIconSetIcon2.Value = 50; // 타겟 범위 : 50 <= 값 < 75 formatConditionIconSetIcon2.ValueComparison = FormatConditionComparisonType.GreaterOrEqual; formatConditionIconSetIcon3.Value = 25; // 타겟 범위 : 25 <= 값 < 50 formatConditionIconSetIcon3.ValueComparison = FormatConditionComparisonType.GreaterOrEqual; formatConditionIconSetIcon4.Value = 0; // 타겟 범위 : 0 <= 값 < 25 formatConditionIconSetIcon4.ValueComparison = FormatConditionComparisonType.GreaterOrEqual; // 아이콘 집합에 아이콘들을 추가한다. formatConditionIconSet.Icons.Add(formatConditionIconSetIcon1); formatConditionIconSet.Icons.Add(formatConditionIconSetIcon2); formatConditionIconSet.Icons.Add(formatConditionIconSetIcon3); formatConditionIconSet.Icons.Add(formatConditionIconSetIcon4); // 규칙 타입을 설정한다. treeListFormatRule.Rule = formatConditionRuleIconSet; // 포맷을 적용할 컬럼을 설정한다. treeListFormatRule.Column = this.marchColumn; // 트리 리스트에 포맷팅 규칙을 추가한다. this.treeList.FormatRules.Add(treeListFormatRule); |