Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações. |
Tradução
Original
|
Classe ToolBar.ToolBarButtonCollection
Encapsula uma coleção de ToolBarButton controles para uso pela ToolBar classe.
Assembly: System.Windows.Forms (em System.Windows.Forms.dll)
The ToolBar.ToolBarButtonCollection é uma coleção indexada baseado em zero usada pela ToolBar classe para manter todo o ToolBarButton controles atribuídos à barra de ferramentas. Use o Add Para adicionar botões individuais e o Remove método excluí-los. Chamar o Clear método para remover todos os botões da coleção.
O exemplo de código a seguir cria e inicializa um ToolBar e três ToolBarButton controles. Os botões da barra de ferramentas são atribuídos para a barra de ferramentas e a barra de ferramentas é adicionada ao formulário. Esse código requer que um Form já foi criado.
publicvoid InitializeMyToolBar()
{
// Create and initialize the ToolBarButton controls and ToolBar.
ToolBar toolBar1 = new ToolBar();
ToolBarButton toolBarButton1 = new ToolBarButton();
ToolBarButton toolBarButton2 = new ToolBarButton();
ToolBarButton toolBarButton3 = new ToolBarButton();
// Set the Text properties of the ToolBarButton controls.
toolBarButton1.Text = "Open";
toolBarButton2.Text = "Save";
toolBarButton3.Text = "Print";
// Add the ToolBarButton controls to the ToolBar.
toolBar1.Buttons.Add(toolBarButton1);
toolBar1.Buttons.Add(toolBarButton2);
toolBar1.Buttons.Add(toolBarButton3);
// Add the ToolBar to the Form.
Controls.Add(toolBar1);
}
public void InitializeMyToolBar()
{
// Create and initialize the ToolBarButton controls and ToolBar.
ToolBar toolBar1 = new ToolBar();
ToolBarButton toolBarButton1 = new ToolBarButton();
ToolBarButton toolBarButton2 = new ToolBarButton();
ToolBarButton toolBarButton3 = new ToolBarButton();
// Set the Text properties of the ToolBarButton controls.
toolBarButton1.set_Text("Open");
toolBarButton2.set_Text("Save");
toolBarButton3.set_Text("Print");
// Add the ToolBarButton controls to the ToolBar.
toolBar1.get_Buttons().Add(toolBarButton1);
toolBar1.get_Buttons().Add(toolBarButton2);
toolBar1.get_Buttons().Add(toolBarButton3);
// Add the ToolBar to the Form.
get_Controls().Add(toolBar1);
} //InitializeMyToolBar
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
o.NET Framework e.NET Compact Framework não oferecem suporte a todas as versões de cada plataforma. Para obter uma lista de versões suportadas, consulte Requisitos de sistema do .NET framework.