File: Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="WizardGreetingCardMaker" %>
Greeting Card Wizard
File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.ComponentModel;
public partial class WizardGreetingCardMaker : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string[] colorArray = Enum.GetNames(typeof(System.Drawing.KnownColor));
lstBackColor.DataSource = colorArray;
lstBackColor.DataBind();
lstForeColor.DataSource = colorArray;
lstForeColor.DataBind();
lstForeColor.SelectedIndex = 34;
lstBackColor.SelectedIndex = 163;
System.Drawing.Text.InstalledFontCollection fonts;
fonts = new System.Drawing.Text.InstalledFontCollection();
foreach (FontFamily family in fonts.Families)
{
lstFontName.Items.Add(family.Name);
}
string[] borderStyleArray = Enum.GetNames(typeof(BorderStyle));
lstBorder.DataSource = borderStyleArray;
lstBorder.DataBind();
lstBorder.SelectedIndex = 0;
imgDefault.ImageUrl = "http://www.rntsoft.com/style/logo.png";
}
}
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
pnlCard.BackColor = Color.FromName(lstBackColor.SelectedItem.Text);
lblGreeting.ForeColor = Color.FromName(lstForeColor.SelectedItem.Text);
lblGreeting.Font.Name = lstFontName.SelectedItem.Text;
try
{
if (Int32.Parse(txtFontSize.Text) > 0)
{
lblGreeting.Font.Size = FontUnit.Point(Int32.Parse(txtFontSize.Text));
}
if (Int32.Parse(txtFontSize.Text) > 0)
{
lblGreeting.Font.Size =
FontUnit.Point(Int32.Parse(txtFontSize.Text));
}
}
catch
{
}
TypeConverter cnvrt = TypeDescriptor.GetConverter(typeof(BorderStyle));
pnlCard.BorderStyle = (BorderStyle)cnvrt.ConvertFromString(lstBorder.SelectedItem.Text);
if (chkPicture.Checked == true)
{
imgDefault.Visible = true;
}
else
{
imgDefault.Visible = false;
}
lblGreeting.Text = txtGreeting.Text;
}
}