Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Using System Dialogs and link labels

0.00/5 (No votes)
8 Aug 2002 1  
This article describes the use of fontdialog and colordialog controls and illustrates the use of linklabel and helpprovider.

Sample Image - SystemDlg.jpg

Introduction

The purpose of the article is to illustrate the use of colordialog, fontdialog, linklabel and helpprovider. This is a simple demo of how they work.

This article illustrates one of my first C# code. I wanted to use MDI control and try out the linklabel control and the helpprovider control.

I had problems creating an About dialog box and hence I coded an application that uses system dialog to change the font and color of a text and the help provider opens the help HTML file, which displays the help message.

The name of the class is MainDlg, which comprises of a Label, colordialog, fontdialog and a helpprovider.

private void menuItem2_Click(object sender, System.EventArgs e)
{
    fontDialog1.ShowDialog();
    label2.Font = fontDialog1.Font;
}

private void menuItem3_Click(object sender, System.EventArgs e)
{
    colorDialog1.ShowDialog();
    label2.ForeColor = colorDialog1.Color;
}

private void menuItem6_Click(object sender, System.EventArgs e)
{
    AboutDlg ne = new AboutDlg();
    ne.ShowDialog();
}

private void menuItem9_Click(object sender, System.EventArgs e)
{
    Help.ShowHelp(new MainDlg() ,"help.htm");
}

There is another class which is an inherited class called AboutDlg, this comprises of a linklabel , which carries an email ID.

By using the following code, the mail recipient is invoked.

private void linkLabel1_LinkClicked_1(object sender, 
     System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
    linkLabel1.LinkVisited = true;
    System.Diagnostics.Process.Start("mailto:ragava@fastmail.ca");
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here