次の方法で共有


BaseTaskForm.SetButtonsPanel(Control) メソッド

定義

ボタン パネルにボタンを追加します。

protected:
 void SetButtonsPanel(System::Windows::Forms::Control ^ buttons);
protected void SetButtonsPanel (System.Windows.Forms.Control buttons);
member this.SetButtonsPanel : System.Windows.Forms.Control -> unit
Protected Sub SetButtonsPanel (buttons As Control)

パラメーター

buttons
Control

Controlパネルに追加するボタンを表す オブジェクト。

例外

buttonsnullです。

このメソッドは以前に呼び出されました。

次の例では、オブジェクトに 2 つのボタンを ManagementPanel 追加し、 メソッドを SetButtonsPanel 使用してボタン パネルを設定します。

void SetButtonsControl() {
    _buttonsPanel = new ManagementPanel();
    _buttonsPanel.SuspendLayout();
    try {
        int x = ClientSize.Width - 11 - _cancelBtn.Width;
        int y = 0;
        int tabIndex = 1638;

        AnchorStyles anchorStyle = AnchorStyles.Bottom | AnchorStyles.Right;

        // Add the Cancel button
        _cancelBtn.Location = new Point(x, y);
        _cancelBtn.Anchor = anchorStyle;
        _cancelBtn.TabIndex = tabIndex++;
        _buttonsPanel.Controls.Add(_cancelBtn);

        x -= _installBtn.Width;
        x -= 6;

        // Add the Install button
        _installBtn.Location = new Point(x, y);
        _installBtn.Anchor = anchorStyle;
        _installBtn.TabIndex = tabIndex++;
        _buttonsPanel.Controls.Add(_installBtn);

        _buttonsPanel.Size = new Size(ClientSize.Width,
                                     11 + 22);
    } finally {
        _buttonsPanel.ResumeLayout(false);
        SetButtonsPanel(_buttonsPanel);
    }
}

適用対象