Share via


BaseTaskForm.SetButtonsPanel(Control) Method

Definition

Adds a button to the button panel.

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)

Parameters

buttons
Control

The Control object that represents the button to add to the panel.

Exceptions

buttons is null.

This method has been previously called.

Examples

The following example adds two buttons to a ManagementPanel object and then uses the SetButtonsPanel method to set the button panel.

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);
    }
}

Applies to