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

Sectionが読み取り専用かどうかを示す値を取得または設定します。
構文
Public Overridable Property ReadOnly As Boolean
public virtual bool ReadOnly {get; set;}

プロパティ値

このSectionが読み取り専用の場合はtrue。それ以外の場合はfalse。既定値はfalseです。
解説
このプロパティをtrueに設定すると、このSection内のすべてのCellが編集できなくなり、すべてのセルのCell.ReadOnlyが常にtrueになってセルの変更が禁止されます。また、Sectionの所有元のGcMultiRowReadOnlyプロパティがtrueの場合は、セクションのReadOnlyも常にtrueになり、セクションを変更できません。
使用例
次のサンプルコードは、セクションを選択可能または選択不可にする方法を示します。たとえば、ヘッダセクションにあるセルを選択して編集できるようにすることができます。このサンプルコードは、Sectionクラスに示されている詳細なコード例の一部を抜粋したものです。
void editColumnHeaderFooterButton_Click(object sender, EventArgs e)
{
    Template template = Template.Default;

    ColumnHeaderSection columnHeaderSection = new ColumnHeaderSection();

    columnHeaderSection.Height = 20;

    TextBoxCell textBoxCell = new TextBoxCell();

    textBoxCell.Size = new Size(template.Width, 20);

    textBoxCell.Value = "The cell in header section, try to edit it";

    columnHeaderSection.Cells.Add(textBoxCell);

    // In default, the cell in the column header section can't be select,
    // If you set column header section's Selectable property to true, the cell can be selected.
    columnHeaderSection.Selectable = true;

    // Event if the column header can be selected, in default, the cell in the column header section can't be edited,
    // If you set column header section's ReadOnly property to false, the cell can be edited.
    columnHeaderSection.ReadOnly = false;

    template.ColumnHeaders.Add(columnHeaderSection);

    // Reload template.
    gcMultiRow1.Template = template;
}
Private Sub editColumnHeaderFooterButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles editColumnHeaderFooterButton.Click
    Dim template1 As Template = Template.Default

    Dim columnHeaderSection As New ColumnHeaderSection()

    columnHeaderSection.Height = 20

    Dim textBoxCell As New TextBoxCell()

    textBoxCell.Size = New Size(template1.Width, 20)

    textBoxCell.Value = "The cell in header section, try to edit it"

    columnHeaderSection.Cells.Add(textBoxCell)

    ' In default, the cell in the column header section can't be select,
    ' If you set column header section's Selectable property to true, the cell can be selected.
    columnHeaderSection.Selectable = True

    ' Event if the column header can be selected, in default, the cell in the column header section can't be edited,
    ' If you set column header section's ReadOnly property to false, the cell can be edited.
    columnHeaderSection.ReadOnly = False

    template1.ColumnHeaders.Add(columnHeaderSection)

    ' Reload template.
    gcMultiRow1.Template = template1
End Sub
参照

Section クラス
Section メンバ

 

 


© 2008-2015 GrapeCity inc. All rights reserved.