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
Este tópico ainda não foi avaliado como - Avalie este tópico

Classe ToolStripLabel

Representa um nonselectable ToolStripItem que processa imagens e texto e pode exibir os hyperlinks.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (em System.Windows.Forms.dll)
[ToolStripItemDesignerAvailabilityAttribute(ToolStripItemDesignerAvailability.ToolStrip)]
public class ToolStripLabel : ToolStripItem

Use o ToolStripLabel classe para criar um rótulo que pode processar texto e imagens que podem implementar o ToolStripItem.TextAlign e ToolStripItem.ImageAlign Propriedades. The ToolStripLabel também tem muitas propriedades que permitem a exibição de um ou mais hiperlinks e outras propriedades que modificar a aparência e comportamento de hiperlinks.

The ToolStripLabel é sistema autônomo um ToolStripButton que não recebe o foco por padrão e que não é processado sistema autônomo enviado ou realçada.

ToolStripLabel sistema autônomo um item de host oferece suporte a teclas de acesso.

Use o LinkColor, LinkVisited, e LinkBehavior propriedades em um ToolStripLabel para dar suporte ao controle de link em um ToolStrip.

O exemplo de código a seguir demonstra como inicializar um ToolStripLabel para conter um link, definindo o IsLink, LinkColor, ActiveLinkColor, VisitedLinkColor, LinkVisited e LinkBehavior Propriedades.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


publicclass Form1 : Form
{
    private ToolStripLabel toolStripLabel1;
    private ToolStrip toolStrip1;

    public Form1()
    {
        InitializeComponent();
    }
    [STAThread]
    staticvoid Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }

    privatevoid InitializeComponent()
    {
        this.toolStrip1 = new System.Windows.Forms.ToolStrip();
        this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
        this.toolStrip1.SuspendLayout();
        this.SuspendLayout();
        // // toolStrip1// this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripLabel1});
        this.toolStrip1.Location = new System.Drawing.Point(0, 0);
        this.toolStrip1.Name = "toolStrip1";
        this.toolStrip1.Size = new System.Drawing.Size(292, 25);
        this.toolStrip1.TabIndex = 0;
        this.toolStrip1.Text = "toolStrip1";
        // // toolStripLabel1// this.toolStripLabel1.IsLink = true;
        this.toolStripLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.AlwaysUnderline;
        this.toolStripLabel1.Name = "toolStripLabel1";
        this.toolStripLabel1.Size = new System.Drawing.Size(71, 22);
        this.toolStripLabel1.Tag = "http://search.microsoft.com/search/search.aspx?";
        this.toolStripLabel1.Text = "Search MSDN";
        this.toolStripLabel1.Click += new System.EventHandler(this.toolStripLabel1_Click);
        // // Form1// this.ClientSize = new System.Drawing.Size(292, 273);
        this.Controls.Add(this.toolStrip1);
        this.Name = "Form1";
        this.toolStrip1.ResumeLayout(false);
        this.toolStrip1.PerformLayout();
        this.ResumeLayout(false);
        this.PerformLayout();

    }

    privatevoid toolStripLabel1_Click(object sender, EventArgs e)
    {
        ToolStripLabel toolStripLabel1 = (ToolStripLabel)sender;

        // Start Internet Explorer and navigate to the URL in the// tag property.
        System.Diagnostics.Process.Start("IEXPLORE.EXE", toolStripLabel1.Tag.ToString());

        // Set the LinkVisited property to true to change the color.
        toolStripLabel1.LinkVisited = true;
    }
}


Quaisquer membros static (Shared no Visual Basic) públicos deste tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.

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

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.

.NET Framework

Compatível com: 3.5, 3.0, 2.0
Isso foi útil para você?
(1500 caracteres restantes)
Conteúdo da Comunidade Adicionar