ICreate.Controls.Bars Send comments on this topic.
Control Property
See Also  Example
ICreate.Controls.Bars Namespace > ButtonBarButton Class : Control Property






Gets or sets the Control whose visibility is controlled by the ButtonBarButton.

Syntax

Visual Basic (Declaration) 
Public Property Control As Control
Visual Basic (Usage)Copy Code
Dim instance As ButtonBarButton
Dim value As Control
 
instance.Control = value
 
value = instance.Control
C# 
public Control Control {get; set;}
Delphi 
public read-write property Control: Control; 
JScript 
public function get,set Control : Control
Managed Extensions for C++ 
public: __property Control get_Control();
public: __property void set_Control( 
   Control value
);
C++/CLI 
public:
property Control Control {
   Control get();
   void set (Control value);
}

Return Value

A reference to a Control, this property stores the Control assigned to the ButtonBarButton. When a ButtonBarButton with a Control is clicked, the Control is made visible. All controls assigned to the other ButtonBarButton instances owned by the ButtonBar are hidden. The default value is null (Nothing in Visual Basic).

Example

This example shows how to assign a Control to a ButtonBarButton. The example creates a ButtonBar docked to the left of the Form. The ButtonBar contains three buttons: Input; Process and Output. Each ButtonBarButton has a  Panel assigned to its Control property, The Panel controls are docked to fill the remaining area of the Form. When a ButtonBarButton is clicked the associated Panel is made visible. All Panels assigned to the other ButtonBarButtons are hidden.
C#Copy Code
using System; 
using System.Drawing; 
using System.Windows.Forms; 
using ICreate.Controls.Bars; 
 
namespace ExamplesButtonBarButtonCSharp 

    public partial class CheckGroupIndentifierExample : Form 
    { 
        public CheckGroupIndentifierExample() 
        { 
            InitializeComponent(); 
 
            string controlCheckGroupIdentifier = "ControlCheckGroup"; 
            ButtonBar buttonBar = new ButtonBar(); 
            buttonBar.Animate = true; 
            buttonBar.Dock = DockStyle.Left; 
            buttonBar.Style = ButtonBarStyle.Office2007; 
 
            ButtonBarButton inputButton = new ButtonBarButton( "Input", Image.FromFile("input.gif" )); 
            ButtonBarButton processButton = new ButtonBarButton( "Process", Image.FromFile("process.gif" )); 
            ButtonBarButton outputButton = new ButtonBarButton( "Output", Image.FromFile("output.gif" )); 
 
            inputButton.TextImageRelation = TextImageRelation.ImageAboveText; 
            processButton.TextImageRelation = TextImageRelation.ImageAboveText; 
            outputButton.TextImageRelation = TextImageRelation.ImageAboveText; 
 
            inputButton.CheckGroupIdentifier = controlCheckGroupIdentifier; 
            processButton.CheckGroupIdentifier = controlCheckGroupIdentifier; 
            outputButton.CheckGroupIdentifier = controlCheckGroupIdentifier; 
 
            inputButton.CheckOnClick = true; 
            processButton.CheckOnClick = true; 
            outputButton.CheckOnClick = true; 
 
            Panel inputPanel = new Panel(); 
            Panel processPanel = new Panel(); 
            Panel outputPanel = new Panel(); 
 
            inputPanel.BackColor = Color.White; 
            inputPanel.Dock = DockStyle.Fill; 
 
            processPanel.BackColor = Color.Cyan; 
            processPanel.Dock = DockStyle.Fill; 
 
            outputPanel.BackColor = Color.LightGray; 
            outputPanel.Dock = DockStyle.Fill; 
 
            inputButton.Control = inputPanel; 
            processButton.Control = processPanel; 
            outputButton.Control = outputPanel; 
 
            buttonBar.Items.Add(inputButton); 
            buttonBar.Items.Add(processButton); 
            buttonBar.Items.Add(outputButton); 
 
            Controls.Add(buttonBar); 
            Controls.Add(inputPanel); 
            Controls.Add(processPanel); 
            Controls.Add(outputPanel); 
        } 
    } 

Visual BasicCopy Code
Imports ICreate.Controls.Bars

Public Class CheckGroupIdentifierExample

    Public Sub New()
        InitializeComponent()

        Dim controlCheckGroupIdentifier As String = "ControlCheckGroup"
        Dim buttonBar As ButtonBar = New ButtonBar
        buttonBar.Animate = True
        buttonBar.Dock = DockStyle.Left
        buttonBar.Style = ButtonBarStyle.Office2007

        Dim inputButton As ButtonBarButton = New ButtonBarButton("Input", Image.FromFile("input.gif"))
        Dim processButton As ButtonBarButton = New ButtonBarButton("Process", Image.FromFile("process.gif"))
        Dim outputButton As ButtonBarButton = New ButtonBarButton("Output", Image.FromFile("output.gif"))

        inputButton.TextImageRelation = TextImageRelation.ImageAboveText
        processButton.TextImageRelation = TextImageRelation.ImageAboveText
        outputButton.TextImageRelation = TextImageRelation.ImageAboveText

        inputButton.CheckGroupIdentifier = controlCheckGroupIdentifier
        processButton.CheckGroupIdentifier = controlCheckGroupIdentifier
        outputButton.CheckGroupIdentifier = controlCheckGroupIdentifier

        inputButton.CheckOnClick = True
        processButton.CheckOnClick = True
        outputButton.CheckOnClick = True

        Dim inputPanel As Panel = New Panel
        Dim processPanel As Panel = New Panel
        Dim outputPanel As Panel = New Panel

        inputPanel.BackColor = Color.White
        inputPanel.Dock = DockStyle.Fill

        processPanel.BackColor = Color.Cyan
        processPanel.Dock = DockStyle.Fill

        outputPanel.BackColor = Color.LightGray
        outputPanel.Dock = DockStyle.Fill

        inputButton.Control = inputPanel
        processButton.Control = processPanel
        outputButton.Control = outputPanel

        buttonBar.Items.Add(inputButton)
        buttonBar.Items.Add(processButton)
        buttonBar.Items.Add(outputButton)

        Controls.Add(buttonBar)
        Controls.Add(inputPanel)
        Controls.Add(processPanel)
        Controls.Add(outputPanel)
    End Sub

End Class

Remarks

It is suggested that all ButtonBarButton instances assigned a Control belong to one check group. If this is so then the currently selected ButtonBarButton will be drawn in the checked state, thus highlighting which ButtonBarButton is selected and hence which Control is visible. If the ButtonBarButton Control is docked to fill its parent, then when it is made visible it is also brought to the front of the Z-order.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also