ColumnHeaderCellにヘッダーの背景を透過して表示するには?
対象製品
MultiRow for Windows Forms 5.0J
詳細
ヘッダーセクションにColumnHeaderCellを配置した場合、ヘッダーの背景は透過して表示されません。それはHeaderCellの仕様によるものです。これを回避するには、下記のようにセルの描画を直接制御する必要がございます。
1.ColumnHeaderCellのBorderを"3D罫線"などに設定する。
(デフォルトではBorderは"Empty"となっているため、設定しないとヘッダーの境界が表示されない)
2.GcMultiRowのCellPaintingイベントで次のようにコードを記述する。
[Visual Basic]
[C#]
1.ColumnHeaderCellのBorderを"3D罫線"などに設定する。
(デフォルトではBorderは"Empty"となっているため、設定しないとヘッダーの境界が表示されない)
2.GcMultiRowのCellPaintingイベントで次のようにコードを記述する。
[Visual Basic]
Private Sub GcMultiRow1_CellPainting(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.CellPaintingEventArgs) Handles GcMultiRow1.CellPainting
If e.Scope = GrapeCity.Win.MultiRow.CellScope.ColumnHeader Then
If TypeOf Me.GcMultiRow1.ColumnHeaders(e.SectionIndex)(e.CellIndex) Is GrapeCity.Win.MultiRow.ColumnHeaderCell Then
' Borderを描画する
e.PaintBorder(e.ClipBounds)
' キャプション文字を描画する
e.PaintForeground(e.ClipBounds)
' それ以外の部分は描画しない
e.Handled = True
End If
End If
End Sub
If e.Scope = GrapeCity.Win.MultiRow.CellScope.ColumnHeader Then
If TypeOf Me.GcMultiRow1.ColumnHeaders(e.SectionIndex)(e.CellIndex) Is GrapeCity.Win.MultiRow.ColumnHeaderCell Then
' Borderを描画する
e.PaintBorder(e.ClipBounds)
' キャプション文字を描画する
e.PaintForeground(e.ClipBounds)
' それ以外の部分は描画しない
e.Handled = True
End If
End If
End Sub
[C#]
private void gcMultiRow1_CellPainting(object sender, GrapeCity.Win.MultiRow.CellPaintingEventArgs e)
{
if (e.Scope == GrapeCity.Win.MultiRow.CellScope.ColumnHeader)
{
if (this.gcMultiRow1.ColumnHeaders[e.SectionIndex][e.CellIndex] is GrapeCity.Win.MultiRow.ColumnHeaderCell)
{
// Borderを描画する
e.PaintBorder(e.ClipBounds);
// キャプション文字を描画する
e.PaintForeground(e.ClipBounds);
// それ以外の部分は描画しない
e.Handled = true;
}
}
}
{
if (e.Scope == GrapeCity.Win.MultiRow.CellScope.ColumnHeader)
{
if (this.gcMultiRow1.ColumnHeaders[e.SectionIndex][e.CellIndex] is GrapeCity.Win.MultiRow.ColumnHeaderCell)
{
// Borderを描画する
e.PaintBorder(e.ClipBounds);
// キャプション文字を描画する
e.PaintForeground(e.ClipBounds);
// それ以外の部分は描画しない
e.Handled = true;
}
}
}
関連情報
この文書は、以前は次のFAQ IDで公開されていました : 11772