Links in strip menu

Asked

Viewed 181 times

1

You can link to a site in the Strip Menu of Windows Forms?

inserir a descrição da imagem aqui

I have the following code snippet in the click of my menu, but does not open the link.

private void menuSobre_Click(object sender, EventArgs e)
{
    WebBrowser webBrowser1 = new WebBrowser();
    webBrowser1.Document.Window.Open("http://www.meusite.com.br","_blank", "location", true);
}

What should I do?

  • You want to click on the menu and open the browser to go to the endeço?

  • Yes @jbueno. That’s what I want

2 answers

1

As far as I know, natively you can’t make it a link in fact, but you can do by code for your application to open the browser with that URL.

Ex:

System.Diagnostics.Process.Start("http://www.website.com");

Original post

1


Natively this does not exist, but it is relatively simple to work on a solution using the class Process and the click event MenuItem.

As long as the links start with http:// the Process.Start() will open the default browser directly at this address.

It is important to remember to include the namespace System.Diagnostics.

Behold:

private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
    var menuItem = (ToolStripItem)sender;
    var link = menuItem.Text;

    Process.Start(link);
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.