セルの背景色を設定するには?
対象製品
MultiRow for Windows Forms 5.0J
詳細
セルの背景色を設定するには、CellStyle.BackColor プロパティを使用します。
ただし、下記のセル型の外観はデフォルトでオペレーティングシステムによって決定され、BackColor プロパティを変更しても反映されません。設定を有効にするには、セルの FlatStyle プロパティを Flat または Popup に設定してください。
サンプルコード:
[Visual Basic]
[C#]
ただし、下記のセル型の外観はデフォルトでオペレーティングシステムによって決定され、BackColor プロパティを変更しても反映されません。設定を有効にするには、セルの FlatStyle プロパティを Flat または Popup に設定してください。
- ButtonCell
- ColumnHeaderCell
- ComboBoxCell
- HeaderCell
- RowHeaderCell
サンプルコード:
[Visual Basic]
Imports GrapeCity.Win.MultiRow
Dim template As Template = New Template()
Dim columnHeaderSection1 As ColumnHeaderSection = New ColumnHeaderSection()
Dim columnHeaderCell1 As ColumnHeaderCell = New ColumnHeaderCell()
Dim textBoxCell1 As TextBoxCell = New TextBoxCell()
textBoxCell1.Style.BackColor = Color.AliceBlue
textBoxCell1.Value = "Hello World"
template.Width = textBoxCell1.Size.Width
template.Row.Cells.Add(textBoxCell1)
template.Row.Height = textBoxCell1.Size.Height
columnHeaderSection1.Cells.Add(columnHeaderCell1)
columnHeaderSection1.Height = columnHeaderCell1.Size.Height
template.ColumnHeaders.Add(columnHeaderSection1)
GcMultiRow1.Template = template
GcMultiRow1.RowCount = 10
Dim template As Template = New Template()
Dim columnHeaderSection1 As ColumnHeaderSection = New ColumnHeaderSection()
Dim columnHeaderCell1 As ColumnHeaderCell = New ColumnHeaderCell()
Dim textBoxCell1 As TextBoxCell = New TextBoxCell()
textBoxCell1.Style.BackColor = Color.AliceBlue
textBoxCell1.Value = "Hello World"
template.Width = textBoxCell1.Size.Width
template.Row.Cells.Add(textBoxCell1)
template.Row.Height = textBoxCell1.Size.Height
columnHeaderSection1.Cells.Add(columnHeaderCell1)
columnHeaderSection1.Height = columnHeaderCell1.Size.Height
template.ColumnHeaders.Add(columnHeaderSection1)
GcMultiRow1.Template = template
GcMultiRow1.RowCount = 10
[C#]
using GrapeCity.Win.MultiRow;
Template template = new Template();
ColumnHeaderSection columnHeaderSection1 = new ColumnHeaderSection();
ColumnHeaderCell columnHeaderCell1 = new ColumnHeaderCell();
TextBoxCell textBoxCell1 = new TextBoxCell();
textBoxCell1.Style.BackColor = Color.AliceBlue;
textBoxCell1.Value = "Hello World";
template.Width = textBoxCell1.Size.Width;
template.Row.Cells.Add(textBoxCell1);
template.Row.Height = textBoxCell1.Size.Height;
columnHeaderSection1.Cells.Add(columnHeaderCell1);
columnHeaderSection1.Height = columnHeaderCell1.Size.Height;
template.ColumnHeaders.Add(columnHeaderSection1);
gcMultiRow1.Template = template;
gcMultiRow1.RowCount = 10;
Template template = new Template();
ColumnHeaderSection columnHeaderSection1 = new ColumnHeaderSection();
ColumnHeaderCell columnHeaderCell1 = new ColumnHeaderCell();
TextBoxCell textBoxCell1 = new TextBoxCell();
textBoxCell1.Style.BackColor = Color.AliceBlue;
textBoxCell1.Value = "Hello World";
template.Width = textBoxCell1.Size.Width;
template.Row.Cells.Add(textBoxCell1);
template.Row.Height = textBoxCell1.Size.Height;
columnHeaderSection1.Cells.Add(columnHeaderCell1);
columnHeaderSection1.Height = columnHeaderCell1.Size.Height;
template.ColumnHeaders.Add(columnHeaderSection1);
gcMultiRow1.Template = template;
gcMultiRow1.RowCount = 10;
この文書は、以前は次のFAQ IDで公開されていました : 11592