Add hyperlink in MessageBox c #

2

Is it possible to customize MessageBox.Show("http://www.google.com/"); so that this link is a hyperlink and when I click open a browser?

The only possibility really would be to create a new form?

    
asked by anonymous 09.04.2017 / 21:43

1 answer

2

There are two options:

  • Create a new form to simulate a MessageBox

    In this case, you only need to create a normal form , add a label to be the link and add the click event on it.

    Eg:

    private void labelLink_Click(object sender, EventArgs e)
    {
        Label lb = (Label)sender;
        Process.Start(lb.Text);
    }
    
  • Use one of the MessageBox buttons to open the link.

    var result = MessageBox.Show("Clique em ok para ir para http://www.google.com");
    
    if(result == DialogResult.Ok)
    {
        Process.Start("http://www.google.com");
    }
    
  • 10.04.2017 / 14:11