private void BuildFormMainArea( ) { switch ( this.taskDialog.MainIcon ) { case TaskDialogIcon.Error: this.pictureBoxMainAreaIcon.Image = SystemIcons.Error.ToBitmap ( ); break; case TaskDialogIcon.Information: this.pictureBoxMainAreaIcon.Image = SystemIcons.Information.ToBitmap ( ); break; case TaskDialogIcon.Shield: this.pictureBoxMainAreaIcon.Image = SystemIcons.Shield.ToBitmap ( ); break; case TaskDialogIcon.Warning: this.pictureBoxMainAreaIcon.Image = SystemIcons.Warning.ToBitmap ( ); break; default: tableLayoutPanelMainArea.ColumnStyles[0].Width = 0; break; } if ( !String.IsNullOrEmpty ( this.taskDialog.MainInstruction ) ) { Label label = new Label ( ); label.AutoSize = true; label.Font = new Font ( this.Font.FontFamily, (float)10.25, FontStyle.Bold ); label.ForeColor = Color.DarkBlue; label.Margin = new Padding ( 0, 0, 0, 15 ); label.Text = this.taskDialog.MainInstruction; this.flowLayoutPanelMainAreaControls.Controls.Add ( label ); } if ( !String.IsNullOrEmpty ( this.taskDialog.Content ) ) { this.flowLayoutPanelMainAreaControls.Controls.Add ( BuildControlLinkLabel ( new Padding ( 0, 0, 0, 15 ), this.taskDialog.Content ) ); } if ( !String.IsNullOrEmpty ( this.taskDialog.ExpandedInformation ) && !this.taskDialog.ExpandFooterArea ) { linkLabelExpandedInformation = BuildControlLinkLabel ( new Padding ( 0, 0, 0, 15 ), this.taskDialog.ExpandedInformation ); this.flowLayoutPanelMainAreaControls.Controls.Add ( linkLabelExpandedInformation ); if ( !this.taskDialog.ExpandedByDefault ) { ToggleExpandedInformationState ( ); } } if ( this.taskDialog.ShowProgressBar || this.taskDialog.ShowMarqueeProgressBar ) { this.progressBar = new ProgressBar ( ); if ( this.taskDialog.ShowMarqueeProgressBar ) { this.progressBar.Style = ProgressBarStyle.Marquee; } this.progressBar.Size = new Size ( this.flowLayoutPanelMainAreaControls.Width - 5, 15 ); this.progressBar.Margin = new Padding ( 0, 0, 0, 5 ); this.flowLayoutPanelMainAreaControls.Controls.Add ( this.progressBar ); } for ( int i = 0; i < this.taskDialog.RadioButtons.Length; i++ ) { RadioButton radioButton = new RadioButton ( ); radioButton.Text = this.taskDialog.RadioButtons[i].ButtonText; radioButton.Tag = this.taskDialog.RadioButtons[i].ButtonId; // Select the first radio button by default. if ( ( i == 0 ) || ( this.taskDialog.DefaultRadioButton == this.taskDialog.RadioButtons[i].ButtonId ) ) { this.defaultRadioButton = radioButton; } this.flowLayoutPanelMainAreaControls.Controls.Add ( radioButton ); } // Command links. if ( this.taskDialog.UseCommandLinks ) { for ( int i = 0; i < this.taskDialog.Buttons.Length; i++ ) { EmulateCommandLink cmdLink = new EmulateCommandLink ( ); cmdLink.Click += new EventHandler ( button_Click ); cmdLink.Tag = this.taskDialog.Buttons[i].ButtonId; cmdLink.Text = this.taskDialog.Buttons[i].ButtonText; cmdLink.Size = new Size ( this.flowLayoutPanelMainAreaControls.Width - 10, cmdLink.GetBestHeight ( ) ); this.taskDialogButtons.Add ( this.taskDialog.Buttons[i].ButtonId, cmdLink ); this.flowLayoutPanelMainAreaControls.Controls.Add ( cmdLink ); } } }
private void BuildFormMainArea( ) { switch (this.taskDialog.MainIcon) { case TaskDialogIcon.Error: this.pictureBoxMainAreaIcon.Image = SystemIcons.Error.ToBitmap( ); break; case TaskDialogIcon.Information: this.pictureBoxMainAreaIcon.Image = SystemIcons.Information.ToBitmap( ); break; case TaskDialogIcon.Shield: this.pictureBoxMainAreaIcon.Image = SystemIcons.Shield.ToBitmap( ); break; case TaskDialogIcon.Warning: this.pictureBoxMainAreaIcon.Image = SystemIcons.Warning.ToBitmap( ); break; default: tableLayoutPanelMainArea.ColumnStyles[0].Width = 0; break; } if (!String.IsNullOrEmpty(this.taskDialog.MainInstruction)) { Label label = new Label( ); label.AutoSize = true; label.Font = new Font(this.Font.FontFamily, (float)10.25, FontStyle.Bold); label.ForeColor = Color.DarkBlue; label.Margin = new Padding(0, 0, 0, 15); label.Text = this.taskDialog.MainInstruction; this.flowLayoutPanelMainAreaControls.Controls.Add(label); } if (!String.IsNullOrEmpty(this.taskDialog.Content)) { this.flowLayoutPanelMainAreaControls.Controls.Add(BuildControlLinkLabel(new Padding(0, 0, 0, 15), this.taskDialog.Content)); } if (!String.IsNullOrEmpty(this.taskDialog.ExpandedInformation) && !this.taskDialog.ExpandFooterArea) { linkLabelExpandedInformation = BuildControlLinkLabel(new Padding(0, 0, 0, 15), this.taskDialog.ExpandedInformation); this.flowLayoutPanelMainAreaControls.Controls.Add(linkLabelExpandedInformation); if (!this.taskDialog.ExpandedByDefault) { ToggleExpandedInformationState( ); } } if (this.taskDialog.ShowProgressBar || this.taskDialog.ShowMarqueeProgressBar) { this.progressBar = new ProgressBar( ); if (this.taskDialog.ShowMarqueeProgressBar) { this.progressBar.Style = ProgressBarStyle.Marquee; } this.progressBar.Size = new Size(this.flowLayoutPanelMainAreaControls.Width - 5, 15); this.progressBar.Margin = new Padding(0, 0, 0, 5); this.flowLayoutPanelMainAreaControls.Controls.Add(this.progressBar); } for (int i = 0; i < this.taskDialog.RadioButtons.Length; i++) { RadioButton radioButton = new RadioButton( ); radioButton.Text = this.taskDialog.RadioButtons[i].ButtonText; radioButton.Tag = this.taskDialog.RadioButtons[i].ButtonId; // Select the first radio button by default. if ((i == 0) || (this.taskDialog.DefaultRadioButton == this.taskDialog.RadioButtons[i].ButtonId)) { this.defaultRadioButton = radioButton; } this.flowLayoutPanelMainAreaControls.Controls.Add(radioButton); } // Command links. if (this.taskDialog.UseCommandLinks) { for (int i = 0; i < this.taskDialog.Buttons.Length; i++) { EmulateCommandLink cmdLink = new EmulateCommandLink( ); cmdLink.Click += new EventHandler(button_Click); cmdLink.Tag = this.taskDialog.Buttons[i].ButtonId; cmdLink.Text = this.taskDialog.Buttons[i].ButtonText; cmdLink.Size = new Size(this.flowLayoutPanelMainAreaControls.Width - 10, cmdLink.GetBestHeight( )); this.taskDialogButtons.Add(this.taskDialog.Buttons[i].ButtonId, cmdLink); this.flowLayoutPanelMainAreaControls.Controls.Add(cmdLink); } } }