PowerTools MultiRow for Windows Forms 8.0J
HoverDirection プロパティ (HeaderCell)
使用例 

ホバー効果の方向を取得または設定します。
構文
Public Property HoverDirection As HoverDirection
public HoverDirection HoverDirection {get; set;}

プロパティ値

ホバー効果の方向を表すHoverDirection値の1つ。
例外
例外解説
System.ComponentModel.InvalidEnumArgumentException指定された値がHoverDirection値の1つではありません。
使用例
次のサンプルコードは、HeaderCellの持ついくつかの重要なプロパティを示します。GutterStylesを使用すると、HeaderCellの周囲にくぼみを描画できます。このくぼみはセルの方向を表し、HeaderCellにホバー効果を与えます。ホバー効果を描画するには、HoverDirectionプロパティを使用します。既定では、HeaderCellの背景の描画にはVisualStyleの背景色が使用されます。独自の設定に従って背景を描画する場合は、FlatStyleUseVisualStyleBackColorを設定し、HeaderCellのCell.Styleを変更します。SelectionModeプロパティは、HeaderCellがクリックされたときにどのセルまたは行を選択するかを指定します。このサンプルコードは、HeaderCellクラスに示されている詳細なコード例の一部を抜粋したものです。
private ColumnHeaderSection CreateColumnHeader()
{
    ColumnHeaderSection columnHeader1 = new ColumnHeaderSection();
    columnHeader1.Height = 20;

    HeaderCell headerCell1 = new HeaderCell();
    headerCell1.Size = new Size(36, 20);
    //There will exist 4 gutters around the HeaderCell.
    headerCell1.GutterStyles = GutterStyles.All;
    headerCell1.HoverDirection = HoverDirection.None;

    //Click the HeaderCell, all rows will be selelected.
    headerCell1.SelectionMode = MultiRowSelectionMode.AllRows;

    //Use the CellStyle.BackColor to draw the HeaderCell's background, don's use the Vistual Style back color.
    headerCell1.FlatStyle = FlatStyle.Standard;
    headerCell1.UseVisualStyleBackColor = false;
    headerCell1.Style.BackColor = Color.DarkGoldenrod;

    ColumnHeaderCell columnHeaderCell1 = new ColumnHeaderCell();
    columnHeaderCell1.Value = "Column1";
    columnHeaderCell1.Size = new Size(80, 20);
    columnHeaderCell1.Location = new Point(headerCell1.Left + headerCell1.Width, 0);
    columnHeaderCell1.Ellipsis = MultiRowEllipsisMode.EllipsisEnd;
    columnHeaderCell1.EllipsisString = "....";

    //The cell's right will draw one gutter.
    columnHeaderCell1.GutterStyles = GutterStyles.Right;
    //The cell's bottom will draw hover effect.
    columnHeaderCell1.HoverDirection = HoverDirection.Bottom;
    //Use the CellStyle.BackColor to draw the HeaderCell's background, don's use the Vistual Style back color.
    columnHeaderCell1.FlatStyle = FlatStyle.Standard;
    columnHeaderCell1.UseVisualStyleBackColor = false;
    columnHeaderCell1.Style.BackColor = Color.DarkGoldenrod;
    columnHeaderCell1.Style.SelectionBackColor = Color.LightBlue;

    ColumnHeaderCell columnHeaderCell2 = columnHeaderCell1.Clone() as ColumnHeaderCell;
    columnHeaderCell2.Location = new Point(columnHeaderCell1.Left + columnHeaderCell1.Width, 0);
    columnHeaderCell2.Value = "Column2";

    columnHeader1.Cells.AddRange(new Cell[] { headerCell1, columnHeaderCell1, columnHeaderCell2 });

    return columnHeader1;
}
Private Function CreateColumnHeader() As ColumnHeaderSection
    Dim columnHeader1 As New ColumnHeaderSection()
    columnHeader1.Height = 20

    Dim headerCell1 As New HeaderCell()
    headerCell1.Size = New Size(36, 20)
    'There will exist 4 gutters around the HeaderCell.
    headerCell1.GutterStyles = GutterStyles.All
    headerCell1.HoverDirection = HoverDirection.None

    'Click the HeaderCell, all rows will be selelected.
    headerCell1.SelectionMode = MultiRowSelectionMode.AllRows

    'Use the CellStyle.BackColor to draw the HeaderCell's background, don's use the Vistual Style back color.
    headerCell1.FlatStyle = FlatStyle.Standard
    headerCell1.UseVisualStyleBackColor = False
    headerCell1.Style.BackColor = Color.DarkGoldenrod

    Dim columnHeaderCell1 As New ColumnHeaderCell()
    columnHeaderCell1.Value = "Column1"
    columnHeaderCell1.Size = New Size(80, 20)
    columnHeaderCell1.Location = New Point(headerCell1.Left + headerCell1.Width, 0)
    columnHeaderCell1.Ellipsis = MultiRowEllipsisMode.EllipsisEnd
    columnHeaderCell1.EllipsisString = "...."

    'The cell's right will draw one gutter.
    columnHeaderCell1.GutterStyles = GutterStyles.Right
    'The cell's bottom will draw hover effect.
    columnHeaderCell1.HoverDirection = HoverDirection.Bottom
    'Use the CellStyle.BackColor to draw the HeaderCell's background, don's use the Vistual Style back color.
    columnHeaderCell1.FlatStyle = FlatStyle.Standard
    columnHeaderCell1.UseVisualStyleBackColor = False
    columnHeaderCell1.Style.BackColor = Color.DarkGoldenrod
    columnHeaderCell1.Style.SelectionBackColor = Color.LightBlue

    Dim columnHeaderCell2 As ColumnHeaderCell = TryCast(columnHeaderCell1.Clone(), ColumnHeaderCell)
    columnHeaderCell2.Location = New Point(columnHeaderCell1.Left + columnHeaderCell1.Width, 0)
    columnHeaderCell2.Value = "Column2"

    columnHeader1.Cells.AddRange(New Cell() {headerCell1, columnHeaderCell1, columnHeaderCell2})

    Return columnHeader1
End Function
参照

HeaderCell クラス
HeaderCell メンバ

 

 


© 2008-2015 GrapeCity inc. All rights reserved.