Category / Section
How to customize WinForms MessageBoxAdv when URL or hyperLink is loaded?
1 min read
Customize the MessageBoxAdv
At present Hyperlink cannot be loaded in MessageBoxAdv and It can be achieved by creating Custom control inherited by MetroForm and loading LinkLabel control in it.
C#
//To show hyperlink MessageBoxExt.ShowHyperLink = true; //Displays the MessageBox text MessageBoxExt.MessageText = "URL MessageBox"; // Shows the Text of URL MessageBoxExt.URLText = "Help"; MessageBoxExt.StartPosition = FormStartPosition.CenterScreen; //Describes the action when link is clicked MessageBoxExt.HyperLink.LinkClicked += new LinkLabelLinkClickedEventHandler(HyperLink_LinkClicked); MessageBoxExt.ShowDialog();
VB
'To show hyperlink MessageBoxExt.ShowHyperLink = True 'Displays the MessageBox text MessageBoxExt.MessageText = "URL MessageBox" ' Shows the Text of URL MessageBoxExt.URLText = "Help" MessageBoxExt.StartPosition = FormStartPosition.CenterScreen 'Describes the action when link is clicked AddHandler MessageBoxExt.HyperLink.LinkClicked, AddressOf HyperLink_LinkClicked MessageBoxExt.ShowDialog()
Figure 1. Customize MessageBoxAdv when URL/HyperLink is loaded with image
Samples:
C#: How to customize MessageBoxAdv when URL/HyperLink is loaded?
VB: How to customize MessageBoxAdv when URL/HyperLink is loaded?