Creating a .NET Windows Installer – Part 1 - The Sample Project
(Page 4 of 14 )
In this article we will create an installer for the .NET project shown below.

This simple application allows the user to choose a font from a drop-down list. The font is drawn onto the form surface in a Paint event handler. The form code (aside from the Windows designer region) is shown below:
public class main : System.Windows.Forms.Form
{
private void main_Load(object sender, EventArgs e)
{
InstalledFontCollection fonts = new InstalledFontCollection();
foreach (FontFamily family in fonts.Families)
{
lstFonts.Items.Add(family.Name);
}
}
private void main_Paint(object sender, PaintEventArgs e)
{
if (lstFonts.Text != "")
{
try
{
e.Graphics.DrawString(lstFonts.Text, new Font(lstFonts.Text,
50), Brushes.Black, 10, 50);
statusBar.Panels[0].Text = "";
}
catch (Exception err)
{
statusBar.Panels[0].Text = err.Message;
}
}
}
private void lstFonts_SelectedIndexChanged(object sender, EventArgs e)
{
if (lstFonts.Text != "") this.Invalidate();
}
}
Next: Creating the Windows Installer Project >>
More C# Articles
More By Wrox Team