作成日: 2022/03/11 最終更新日: 2022/03/30
文書種別
使用方法
詳細
ダイナミック セルスタイルの適用条件を匿名メソッドで記述するには、DynamicCellStyleクラスのコンストラクタの引数を使用します。
[C#]
[C#]
using GrapeCity.Win.MultiRow;
Template template1 = Template.Default;
DynamicCellStyle dynamicCellStyle1 = new DynamicCellStyle(delegate(DynamicCellStyleContext context)
{
CellStyle backColorCellStyle = new CellStyle();
if (context.CellScope == CellScope.Row && (context.RowIndex % 2) == 0)
{
backColorCellStyle.BackColor = Color.LightBlue;
}
else
{
backColorCellStyle.BackColor = Color.LightCoral;
}
return backColorCellStyle;
});
template1.Row.DefaultCellStyle = dynamicCellStyle1;
gcMultiRow1.Template = template1;
gcMultiRow1.RowCount = 20;