1 //------------------------------------------------------------------------------
2 // <copyright file="TaskFormBase.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner       Microsoft
7 // @backupOwner Microsoft
8 //------------------------------------------------------------------------------
9 
10 using System;
11 using System.Collections;
12 using System.ComponentModel;
13 using System.ComponentModel.Design;
14 using System.Design;
15 using System.Diagnostics;
16 using System.Drawing;
17 using System.Windows.Forms;
18 using System.Windows.Forms.Design;
19 
20 namespace System.Web.UI.Design.WebControls.Util
21 {
22     /// <devdoc>
23     /// Represents a wizard used to guide users through configuration processes.
24     /// </devdoc>
25     internal abstract class TaskFormBase : DesignerForm
26     {
27 
28         private System.Windows.Forms.Panel _taskPanel;
29         private System.Windows.Forms.Label _bottomDividerLabel;
30         private System.Windows.Forms.Panel _headerPanel;
31         private System.Windows.Forms.Label _captionLabel;
32         private System.Windows.Forms.PictureBox _glyphPictureBox;
33 
34         /// <devdoc>
35         /// Creates a new TaskForm with a given service provider.
36         /// </devdoc>
TaskFormBase(IServiceProvider serviceProvider)37         public TaskFormBase(IServiceProvider serviceProvider)
38             : base(serviceProvider)
39         {
40             InitializeComponent();
41             InitializeUI();
42         }
43 
44         protected System.Windows.Forms.Label CaptionLabel
45         {
46             get
47             {
48                 return _captionLabel;
49             }
50         }
51 
52         /// <devdoc>
53         /// A glyph for the wizard.
54         /// </devdoc>
SetGlyph(System.Drawing.Image value)55         protected void SetGlyph(System.Drawing.Image value)
56         {
57             _glyphPictureBox.Image = value;
58         }
59 
60         protected System.Windows.Forms.Panel TaskPanel
61         {
62             get
63             {
64                 return _taskPanel;
65             }
66         }
67 
68         #region Designer generated code
69         /// <summary>
70         /// Required method for Designer support - do not modify
71         /// the contents of this method with the code editor.
72         /// </summary>
InitializeComponent()73         private void InitializeComponent()
74         {
75 
76             this._taskPanel = new System.Windows.Forms.Panel();
77             this._bottomDividerLabel = new System.Windows.Forms.Label();
78             this._captionLabel = new System.Windows.Forms.Label();
79             this._headerPanel = new System.Windows.Forms.Panel();
80             this._glyphPictureBox = new System.Windows.Forms.PictureBox();
81             this._headerPanel.SuspendLayout();
82             ((System.ComponentModel.ISupportInitialize)(this._glyphPictureBox)).BeginInit();
83             this.SuspendLayout();
84 
85             //
86             // _taskPanel
87             //
88             this._taskPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
89                         | System.Windows.Forms.AnchorStyles.Left)
90                         | System.Windows.Forms.AnchorStyles.Right)));
91             this._taskPanel.Location = new System.Drawing.Point(0, 63);
92             this._taskPanel.Name = "_taskPanel";
93             this._taskPanel.Size = new System.Drawing.Size(528, 319);
94             this._taskPanel.TabIndex = 30;
95             //
96             // _bottomDividerLabel
97             //
98             this._bottomDividerLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
99                         | System.Windows.Forms.AnchorStyles.Right)));
100             this._bottomDividerLabel.BackColor = System.Drawing.SystemColors.ControlLightLight;
101             this._bottomDividerLabel.Location = new System.Drawing.Point(0, 382);
102             this._bottomDividerLabel.Name = "_bottomDividerLabel";
103             this._bottomDividerLabel.Size = new System.Drawing.Size(572, 1);
104             this._bottomDividerLabel.TabIndex = 40;
105             //
106             // _headerPanel
107             //
108             this._headerPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
109                         | System.Windows.Forms.AnchorStyles.Right)));
110             this._headerPanel.BackColor = System.Drawing.SystemColors.ControlLightLight;
111             this._headerPanel.Controls.Add(this._glyphPictureBox);
112             this._headerPanel.Controls.Add(this._captionLabel);
113             this._headerPanel.Location = new System.Drawing.Point(0, 0);
114             this._headerPanel.Name = "_headerPanel";
115             this._headerPanel.Size = new System.Drawing.Size(572, 63);
116             this._headerPanel.TabIndex = 10;
117             //
118             // _glyphPictureBox
119             //
120             this._glyphPictureBox.Location = new System.Drawing.Point(0, 0);
121             this._glyphPictureBox.Name = "_glyphPictureBox";
122             this._glyphPictureBox.Size = new System.Drawing.Size(65, 63);
123             this._glyphPictureBox.TabIndex = 20;
124             this._glyphPictureBox.TabStop = false;
125             //
126             // _captionLabel
127             //
128             this._captionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
129                         | System.Windows.Forms.AnchorStyles.Right)));
130             this._captionLabel.Location = new System.Drawing.Point(71, 17);
131             this._captionLabel.Name = "_captionLabel";
132             this._captionLabel.Size = new System.Drawing.Size(487, 47);
133             this._captionLabel.TabIndex = 10;
134             //
135             // TaskForm
136             //
137             this.ClientSize = new System.Drawing.Size(530, 423);
138             this.Controls.Add(this._headerPanel);
139             this.Controls.Add(this._bottomDividerLabel);
140             this.Controls.Add(this._taskPanel);
141             this.Name = "TaskForm";
142             this._headerPanel.ResumeLayout(false);
143             ((System.ComponentModel.ISupportInitialize)(this._glyphPictureBox)).EndInit();
144             this.ResumeLayout(false);
145             this.PerformLayout();
146         }
147         #endregion
148 
149         /// <devdoc>
150         /// Called after InitializeComponent to perform additional actions that
151         /// are not supported by the designer.
152         /// </devdoc>
InitializeUI()153         private void InitializeUI()
154         {
155             UpdateFonts();
156         }
157 
OnFontChanged(EventArgs e)158         protected override void OnFontChanged(EventArgs e)
159         {
160             base.OnFontChanged(e);
161             UpdateFonts();
162         }
163 
UpdateFonts()164         private void UpdateFonts()
165         {
166             _captionLabel.Font = new Font(Font.FontFamily, Font.Size + 2.0f, FontStyle.Bold, Font.Unit);
167         }
168     }
169 }
170 
171