DotNet 4.8.1 build of DotNetBar

This commit is contained in:
2025-02-07 10:35:23 -05:00
parent 33439b63a0
commit 6b0a5d60f4
2609 changed files with 989814 additions and 7 deletions

View File

@@ -0,0 +1,660 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace DevComponents.DotNetBar
{
/// <summary>
/// Represent a task-dialog message box window.
/// </summary>
public static class TaskDialog
{
/// <summary>
/// Displays TaskDialog message.
/// </summary>
/// <param name="dialogTitle">Title of the window.</param>
/// <param name="dialogHeader">Task dialog header.</param>
/// <param name="dialogText">Task dialog text.</param>
/// <param name="dialogButtons">Displayed buttons.</param>
/// <returns>Result from task-dialog.</returns>
public static eTaskDialogResult Show(string dialogTitle, string dialogHeader, string dialogText, eTaskDialogButton dialogButtons)
{
TaskDialogInfo info = new TaskDialogInfo(dialogTitle, eTaskDialogIcon.Information, dialogHeader, dialogText, dialogButtons);
return Show(info);
}
/// <summary>
/// Displays TaskDialog message.
/// </summary>
/// <param name="dialogTitle">Title of the window.</param>
/// <param name="dialogHeader">Task dialog header.</param>
/// <param name="dialogText">Task dialog text.</param>
/// <param name="dialogButtons">Displayed buttons.</param>
/// <param name="dialogColor">Specifies the predefined color for the dialog.</param>
/// <returns>Result from task-dialog.</returns>
public static eTaskDialogResult Show(string dialogTitle, string dialogHeader, string dialogText, eTaskDialogButton dialogButtons, eTaskDialogBackgroundColor dialogColor)
{
TaskDialogInfo info = new TaskDialogInfo(dialogTitle, eTaskDialogIcon.Information, dialogHeader, dialogText, dialogButtons, dialogColor);
return Show(info);
}
/// <summary>
/// Displays TaskDialog message.
/// </summary>
/// <param name="dialogTitle">Title of the window.</param>
/// <param name="dialogIcon">Icon displayed on dialog.</param>
/// <param name="dialogHeader">Task dialog header.</param>
/// <param name="dialogText">Task dialog text.</param>
/// <param name="dialogButtons">Displayed buttons.</param>
/// <returns>Result from task-dialog.</returns>
public static eTaskDialogResult Show(string dialogTitle, eTaskDialogIcon dialogIcon, string dialogHeader, string dialogText, eTaskDialogButton dialogButtons)
{
TaskDialogInfo info = new TaskDialogInfo(dialogTitle, dialogIcon, dialogHeader, dialogText, dialogButtons);
return Show(info);
}
/// <summary>
/// Displays TaskDialog message.
/// </summary>
/// <param name="dialogTitle">Title of the window.</param>
/// <param name="dialogIcon">Icon displayed on dialog.</param>
/// <param name="dialogHeader">Task dialog header.</param>
/// <param name="dialogText">Task dialog text.</param>
/// <param name="dialogButtons">Displayed buttons.</param>
/// <param name="dialogColor">Specifies the predefined color for the dialog.</param>
/// <returns>Result from task-dialog.</returns>
public static eTaskDialogResult Show(string dialogTitle, eTaskDialogIcon dialogIcon, string dialogHeader, string dialogText, eTaskDialogButton dialogButtons, eTaskDialogBackgroundColor dialogColor)
{
TaskDialogInfo info = new TaskDialogInfo(dialogTitle, dialogIcon, dialogHeader, dialogText, dialogButtons, dialogColor);
return Show(info);
}
/// <summary>
/// Displays TaskDialog message.
/// </summary>
/// <param name="info">Specifies the content of the task dialog.</param>
/// <returns>Result from task-dialog.</returns>
public static eTaskDialogResult Show(TaskDialogInfo info)
{
return Show(null, info);
}
private static TaskDialogForm _TaskDialogForm = null;
/// <summary>
/// Displays TaskDialog message.
/// </summary>
/// <param name="owner">Window owner of the task dialog.</param>
/// <param name="info">Specifies the content of the task dialog.</param>
/// <returns>Result from task-dialog.</returns>
public static eTaskDialogResult Show(IWin32Window owner, TaskDialogInfo info)
{
eTaskDialogResult result = eTaskDialogResult.None;
TaskDialogForm taskDialog = new TaskDialogForm();
try
{
_TaskDialogForm = taskDialog;
if (!_AntiAlias)
taskDialog.AntiAlias = _AntiAlias;
taskDialog.EnableGlass = _EnableGlass && !StyleManager.IsMetro(StyleManager.Style);
taskDialog.TopMost = info.TopMost;
if (!info.FormCloseEnabled)
taskDialog.CloseEnabled = false;
taskDialog.ShowTaskDialog(owner, info);
result = taskDialog.Result;
}
finally
{
taskDialog.Dispose();
_TaskDialogForm = null;
}
return result;
}
/// <summary>
/// Closes the task dialog if it is open with eTaskDialogResult.None result.
/// </summary>
public static void Close()
{
Close(eTaskDialogResult.None);
}
/// <summary>
/// Closes the task dialog if it is open with specified result value.
/// </summary>
/// <param name="result">Value that will be used as return value from Show method.</param>
public static void Close(eTaskDialogResult result)
{
if (_TaskDialogForm == null)
throw new NullReferenceException("Task Dialog Form is not shown.");
_TaskDialogForm.CloseDialog(result);
}
private static bool _EnableGlass = true;
/// <summary>
/// Gets or sets whether TaskDialog form has Windows Vista Glass enabled if running on
/// Windows Vista with Glass enabled. Default value is true.
/// </summary>
public static bool EnableGlass
{
get { return _EnableGlass; }
set
{
_EnableGlass = value;
}
}
private static bool _AntiAlias = true;
/// <summary>
/// Gets or sets the anti-alias text-rendering setting for the controls on task-dialog. Default value is true.
/// </summary>
public static bool AntiAlias
{
get { return _AntiAlias; }
set
{
_AntiAlias = value;
}
}
internal static Image GetImage(eTaskDialogIcon icon)
{
if (icon == eTaskDialogIcon.None) return null;
return BarFunctions.LoadBitmap("SystemImages.Task" + icon.ToString() + ".png");
}
/// <summary>
/// Occurs when any text markup link on Task-Dialog Box is clicked. Markup links can be created using "a" tag, for example:
/// <a name="MyLink">Markup link</a>
/// </summary>
public static event MarkupLinkClickEventHandler MarkupLinkClick;
internal static void InvokeMarkupLinkClick(object sender, MarkupLinkClickEventArgs e)
{
MarkupLinkClickEventHandler h = MarkupLinkClick;
if (h != null)
h(sender, e);
}
}
/// <summary>
/// Specifies the information displayed on task-dialog.
/// </summary>
public struct TaskDialogInfo
{
/// <summary>
/// Initializes a new instance of the TaskDialogInfo structure.
/// </summary>
/// <param name="title">Title of dialog.</param>
/// <param name="taskDialogIcon">Task-dialog icon</param>
/// <param name="header">Header text.</param>
/// <param name="text">Dialog main/content text.</param>
/// <param name="dialogButtons">Dialog buttons displayed.</param>
/// <param name="dialogColor">Dialog background color.</param>
/// <param name="radioButtons">Radio Button Commands</param>
/// <param name="buttons">Button commands.</param>
/// <param name="checkBoxCommand">Check-box command.</param>
/// <param name="footerText">Footer text</param>
/// <param name="footerImage">Footer image.</param>
public TaskDialogInfo(string title, eTaskDialogIcon taskDialogIcon, string header, string text, eTaskDialogButton dialogButtons, eTaskDialogBackgroundColor dialogColor, Command[] radioButtons, Command[] buttons, Command checkBoxCommand, string footerText, Image footerImage)
{
_Title = title;
_Header = header;
_Text = text;
_DialogButtons = dialogButtons;
_DialogColor = dialogColor;
_RadioButtons = radioButtons;
_Buttons = buttons;
_FooterText = footerText;
_CheckBoxCommand = checkBoxCommand;
_TaskDialogIcon = taskDialogIcon;
_FooterImage = footerImage;
_TopMost = false;
_DefaultButton = eTaskDialogButton.Ok;
_FormCloseEnabled = true;
}
/// <summary>
/// Initializes a new instance of the TaskDialogInfo structure.
/// </summary>
/// <param name="title">Title of dialog.</param>
/// <param name="taskDialogIcon">Task-dialog icon</param>
/// <param name="header">Header text.</param>
/// <param name="text">Dialog main/content text.</param>
/// <param name="dialogButtons">Dialog buttons displayed.</param>
/// <param name="dialogColor">Dialog background color.</param>
/// <param name="radioButtons">Radio Button Commands</param>
/// <param name="buttons">Button commands.</param>
/// <param name="checkBoxCommand">Check-box command.</param>
/// <param name="footerText">Footer text</param>
/// <param name="footerImage">Footer image.</param>
/// <param name="topMost">Indicates whether TaskDialog is top most.</param>
public TaskDialogInfo(string title, eTaskDialogIcon taskDialogIcon, string header, string text, eTaskDialogButton dialogButtons, eTaskDialogBackgroundColor dialogColor, Command[] radioButtons, Command[] buttons, Command checkBoxCommand, string footerText, Image footerImage, bool topMost)
{
_Title = title;
_Header = header;
_Text = text;
_DialogButtons = dialogButtons;
_DialogColor = dialogColor;
_RadioButtons = radioButtons;
_Buttons = buttons;
_FooterText = footerText;
_CheckBoxCommand = checkBoxCommand;
_TaskDialogIcon = taskDialogIcon;
_FooterImage = footerImage;
_TopMost = topMost;
_DefaultButton = eTaskDialogButton.Ok;
_FormCloseEnabled = true;
}
/// <summary>
/// Initializes a new instance of the TaskDialogInfo structure.
/// </summary>
/// <param name="title">Title of dialog.</param>
/// <param name="taskDialogIcon">Task-dialog icon</param>
/// <param name="header">Header text.</param>
/// <param name="text">Dialog main/content text.</param>
/// <param name="dialogButtons">Dialog buttons displayed.</param>
/// <param name="dialogColor">Dialog background color.</param>
public TaskDialogInfo(string title, eTaskDialogIcon taskDialogIcon, string header, string text, eTaskDialogButton dialogButtons, eTaskDialogBackgroundColor dialogColor)
{
_Title = title;
_Header = header;
_Text = text;
_DialogButtons = dialogButtons;
_DialogColor = dialogColor;
_RadioButtons = null;
_Buttons = null;
_FooterText = null;
_CheckBoxCommand = null;
_TaskDialogIcon = taskDialogIcon;
_FooterImage = null;
_TopMost = false;
_DefaultButton = eTaskDialogButton.Ok;
_FormCloseEnabled = true;
}
/// <summary>
/// Initializes a new instance of the TaskDialogInfo structure.
/// </summary>
/// <param name="title">Title of dialog.</param>
/// <param name="taskDialogIcon">Task-dialog icon</param>
/// <param name="header">Header text.</param>
/// <param name="text">Dialog main/content text.</param>
/// <param name="dialogButtons">Dialog buttons displayed.</param>
public TaskDialogInfo(string title, eTaskDialogIcon taskDialogIcon, string header, string text, eTaskDialogButton dialogButtons)
{
_Title = title;
_Header = header;
_Text = text;
_DialogButtons = dialogButtons;
_DialogColor = eTaskDialogBackgroundColor.Default;
_RadioButtons = null;
_Buttons = null;
_FooterText = null;
_CheckBoxCommand = null;
_TaskDialogIcon = taskDialogIcon;
_FooterImage = null;
_TopMost = false;
_DefaultButton = eTaskDialogButton.Ok;
_FormCloseEnabled = true;
}
/// <summary>
/// Initializes a new instance of the TaskDialogInfo structure.
/// </summary>
/// <param name="title">Title of dialog.</param>
/// <param name="taskDialogIcon">Task-dialog icon</param>
/// <param name="header">Header text.</param>
/// <param name="text">Dialog main/content text.</param>
/// <param name="dialogButtons">Dialog buttons displayed.</param>
public TaskDialogInfo(string title, eTaskDialogIcon taskDialogIcon, string header, string text, eTaskDialogButton dialogButtons, eTaskDialogButton defaultButton)
{
_Title = title;
_Header = header;
_Text = text;
_DialogButtons = dialogButtons;
_DialogColor = eTaskDialogBackgroundColor.Default;
_RadioButtons = null;
_Buttons = null;
_FooterText = null;
_CheckBoxCommand = null;
_TaskDialogIcon = taskDialogIcon;
_FooterImage = null;
_TopMost = false;
_DefaultButton = defaultButton;
_FormCloseEnabled = true;
}
private string _Title;
/// <summary>
/// Gets or sets the task-dialog window title.
/// </summary>
public string Title
{
get { return _Title; }
set
{
_Title = value;
}
}
private string _Header;
/// <summary>
/// Gets or sets the task-dialog header.
/// </summary>
public string Header
{
get { return _Header; }
set
{
_Header = value;
}
}
private string _Text;
/// <summary>
/// Gets or sets the task-dialog text.
/// </summary>
public string Text
{
get { return _Text; }
set
{
_Text = value;
}
}
private eTaskDialogButton _DialogButtons;
/// <summary>
/// Gets or sets the task-dialog buttons displayed.
/// </summary>
public eTaskDialogButton DialogButtons
{
get { return _DialogButtons; }
set { _DialogButtons = value; }
}
private eTaskDialogBackgroundColor _DialogColor;
/// <summary>
/// Gets or sets the task-dialog background color.
/// </summary>
public eTaskDialogBackgroundColor DialogColor
{
get { return _DialogColor; }
set { _DialogColor = value; }
}
private Command[] _RadioButtons;
/// <summary>
/// Gets or sets the array of commands that will be used to create the radio-buttons displayed on task-dialog. Each command will be executed as radio-buttons are checked by user.
/// </summary>
public Command[] RadioButtons
{
get { return _RadioButtons; }
set { _RadioButtons = value; }
}
private Command[] _Buttons;
/// <summary>
/// Gets or sets the array of commands that will be used to create the buttons displayed on task-dialog. Each command will be executed as buttons are clicked by user.
/// </summary>
public Command[] Buttons
{
get { return _Buttons; }
set { _Buttons = value; }
}
private string _FooterText;
/// <summary>
/// Gets or sets the footer text displayed on task-dialog.
/// </summary>
public string FooterText
{
get { return _FooterText; }
set
{
_FooterText = value;
}
}
private Command _CheckBoxCommand;
/// <summary>
/// Gets or sets the command that is used to initialize the footer check-box. Command will be executed when check-box state changes by end user.
/// </summary>
public Command CheckBoxCommand
{
get { return _CheckBoxCommand; }
set { _CheckBoxCommand = value; }
}
private eTaskDialogIcon _TaskDialogIcon;
/// <summary>
/// Gets or sets the icon that is displayed on task dialog.
/// </summary>
public eTaskDialogIcon TaskDialogIcon
{
get { return _TaskDialogIcon; }
set { _TaskDialogIcon = value; }
}
private Image _FooterImage;
/// <summary>
/// Gets or sets the image that is displayed in the task-dialog footer. Expected image size is 16x16 pixels.
/// </summary>
public Image FooterImage
{
get { return _FooterImage; }
set { _FooterImage = value; }
}
private bool _TopMost;
/// <summary>
/// Gets or sets whether TaskDialog form is top-most. Default value is false.
/// </summary>
public bool TopMost
{
get { return _TopMost; }
set
{
_TopMost = value;
}
}
private eTaskDialogButton _DefaultButton;
/// <summary>
/// Gets or sets the TaskDialog default button.
/// </summary>
public eTaskDialogButton DefaultButton
{
get { return _DefaultButton; }
set { _DefaultButton = value; }
}
private bool _FormCloseEnabled;
/// <summary>
/// Indicates whether task dialog form close button is enabled, default value is true.
/// </summary>
public bool FormCloseEnabled
{
get { return _FormCloseEnabled; }
set
{
_FormCloseEnabled = value;
}
}
}
/// <summary>
/// Specifies the task dialog buttons.
/// </summary>
[Flags]
public enum eTaskDialogButton
{
/// <summary>
/// OK button will be displayed.
/// </summary>
Ok = 1,
/// <summary>
/// Yes button will be displayed.
/// </summary>
Yes = 2,
/// <summary>
/// No button will be displayed.
/// </summary>
No = 4,
/// <summary>
/// Cancel button will be displayed.
/// </summary>
Cancel = 8,
/// <summary>
/// Retry button will be displayed.
/// </summary>
Retry = 16,
/// <summary>
/// Close button will be displayed.
/// </summary>
Close = 32
}
/// <summary>
/// Specifies the task dialog return values.
/// </summary>
public enum eTaskDialogResult
{
/// <summary>
/// No button was clicked because dialog was closed using TaskDialog.Close method.
/// </summary>
None,
/// <summary>
/// OK button was clicked.
/// </summary>
Ok,
/// <summary>
/// Yes button was clicked.
/// </summary>
Yes,
/// <summary>
/// No button was clicked.
/// </summary>
No,
/// <summary>
/// Cancel button was clicked.
/// </summary>
Cancel,
/// <summary>
/// Retry button was clicked.
/// </summary>
Retry,
/// <summary>
/// Close button was clicked.
/// </summary>
Close,
/// <summary>
/// Specifies the custom result. Custom result can be specified if TaskDialog.Close method is called to close dialog.
/// </summary>
Custom1,
/// <summary>
/// Specifies the custom result. Custom result can be specified if TaskDialog.Close method is called to close dialog.
/// </summary>
Custom2,
/// <summary>
/// Specifies the custom result. Custom result can be specified if TaskDialog.Close method is called to close dialog.
/// </summary>
Custom3
}
/// <summary>
/// Define icons available on TaskDialog.
/// </summary>
public enum eTaskDialogIcon
{
/// <summary>
/// No icon.
/// </summary>
None,
/// <summary>
/// Blue flag icon.
/// </summary>
BlueFlag,
/// <summary>
/// Blue stop icon.
/// </summary>
BlueStop,
/// <summary>
/// Light bulb, idea icon.
/// </summary>
Bulb,
/// <summary>
/// Check-mark icon.
/// </summary>
CheckMark,
/// <summary>
/// Check-mark icon.
/// </summary>
CheckMark2,
/// <summary>
/// Trash-can delete icon.
/// </summary>
Delete,
/// <summary>
/// Exclamation icon.
/// </summary>
Exclamation,
/// <summary>
/// Flag icon.
/// </summary>
Flag,
/// <summary>
/// Hand-stop icon.
/// </summary>
Hand,
/// <summary>
/// Help icon.
/// </summary>
Help,
/// <summary>
/// Informational icon.
/// </summary>
Information,
/// <summary>
/// Informational icon.
/// </summary>
Information2,
/// <summary>
/// No entry icon.
/// </summary>
NoEntry,
/// <summary>
/// Shield icon.
/// </summary>
Shield,
/// <summary>
/// Shield help icon.
/// </summary>
ShieldHelp,
/// <summary>
/// Shield OK icon.
/// </summary>
ShieldOk,
/// <summary>
/// Shield stop icon.
/// </summary>
ShieldStop,
/// <summary>
/// Stop icon.
/// </summary>
Stop,
/// <summary>
/// Stop icon.
/// </summary>
Stop2,
/// <summary>
/// Users icons.
/// </summary>
Users
}
}

View File

@@ -0,0 +1,350 @@
using System.Windows.Forms;
namespace DevComponents.DotNetBar
{
partial class TaskDialogForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.headerImage = new System.Windows.Forms.PictureBox();
this.headerLabel = new DevComponents.DotNetBar.LabelX();
this.contentLabel = new DevComponents.DotNetBar.LabelX();
this.buttonsPanel = new DevComponents.DotNetBar.ItemPanel();
this.bottomPanel = new DevComponents.DotNetBar.PanelEx();
this.footerLabel = new DevComponents.DotNetBar.LabelX();
this.footerImage = new System.Windows.Forms.PictureBox();
this.taskCheckBox = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.footerPanel = new DevComponents.DotNetBar.PanelEx();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.buttonClose = new DevComponents.DotNetBar.ButtonX();
this.buttonRetry = new DevComponents.DotNetBar.ButtonX();
this.buttonCancel = new DevComponents.DotNetBar.ButtonX();
this.buttonOk = new DevComponents.DotNetBar.ButtonX();
this.buttonNo = new DevComponents.DotNetBar.ButtonX();
this.buttonYes = new DevComponents.DotNetBar.ButtonX();
((System.ComponentModel.ISupportInitialize)(this.headerImage)).BeginInit();
this.bottomPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.footerImage)).BeginInit();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// headerImage
//
this.headerImage.Location = new System.Drawing.Point(12, 12);
this.headerImage.Name = "headerImage";
this.headerImage.Size = new System.Drawing.Size(32, 32);
this.headerImage.SizeMode = PictureBoxSizeMode.Zoom;
this.headerImage.TabIndex = 0;
this.headerImage.TabStop = false;
//
// headerLabel
//
this.headerLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//
//
//
this.headerLabel.BackgroundStyle.Class = "";
this.headerLabel.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.headerLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.headerLabel.Location = new System.Drawing.Point(50, 12);
this.headerLabel.Name = "headerLabel";
this.headerLabel.Size = new System.Drawing.Size(444, 32);
this.headerLabel.TabIndex = 0;
this.headerLabel.Text = "Task Dialog Header Instructions";
this.headerLabel.TextLineAlignment = System.Drawing.StringAlignment.Near;
this.headerLabel.WordWrap = true;
//
// contentLabel
//
this.contentLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//
//
//
this.contentLabel.BackgroundStyle.Class = "";
this.contentLabel.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.contentLabel.Location = new System.Drawing.Point(50, 60);
this.contentLabel.Name = "contentLabel";
this.contentLabel.Size = new System.Drawing.Size(444, 35);
this.contentLabel.TabIndex = 1;
this.contentLabel.Text = "Task Dialog actual content of the dialog with some instructions and more text wit" +
"h text-markup support and word wrapping.";
this.contentLabel.TextLineAlignment = System.Drawing.StringAlignment.Near;
this.contentLabel.WordWrap = true;
//
// buttonsPanel
//
this.buttonsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//
//
//
this.buttonsPanel.BackgroundStyle.Class = "";
this.buttonsPanel.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.buttonsPanel.ContainerControlProcessDialogKey = true;
this.buttonsPanel.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical;
#if !TRIAL
this.buttonsPanel.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
#endif
this.buttonsPanel.Location = new System.Drawing.Point(50, 101);
this.buttonsPanel.Name = "buttonsPanel";
this.buttonsPanel.Size = new System.Drawing.Size(444, 120);
this.buttonsPanel.TabIndex = 2;
this.buttonsPanel.Text = "itemPanel1";
//
// bottomPanel
//
this.bottomPanel.CanvasColor = System.Drawing.SystemColors.Control;
this.bottomPanel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.bottomPanel.Controls.Add(this.footerLabel);
this.bottomPanel.Controls.Add(this.footerImage);
this.bottomPanel.Controls.Add(this.taskCheckBox);
this.bottomPanel.Controls.Add(this.footerPanel);
this.bottomPanel.Controls.Add(this.flowLayoutPanel1);
this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.bottomPanel.Location = new System.Drawing.Point(0, 240);
this.bottomPanel.Name = "bottomPanel";
this.bottomPanel.Padding = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.bottomPanel.Size = new System.Drawing.Size(506, 70);
this.bottomPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
this.bottomPanel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(239)))), ((int)(((byte)(255)))));
this.bottomPanel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.bottomPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
this.bottomPanel.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.Top;
this.bottomPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.bottomPanel.Style.GradientAngle = 90;
this.bottomPanel.TabIndex = 0;
//
// footerLabel
//
this.footerLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//
//
//
this.footerLabel.BackgroundStyle.Class = "";
this.footerLabel.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.footerLabel.Location = new System.Drawing.Point(33, 49);
this.footerLabel.Name = "footerLabel";
this.footerLabel.Size = new System.Drawing.Size(467, 15);
this.footerLabel.TabIndex = 2;
this.footerLabel.Text = "Footer Label with text-markup support";
//
// footerImage
//
this.footerImage.Location = new System.Drawing.Point(8, 48);
this.footerImage.Name = "footerImage";
this.footerImage.Size = new System.Drawing.Size(16, 16);
this.footerImage.TabIndex = 8;
this.footerImage.SizeMode = PictureBoxSizeMode.Zoom;
this.footerImage.TabStop = false;
//
// taskCheckBox
//
this.taskCheckBox.AutoSize = true;
//
//
//
this.taskCheckBox.BackgroundStyle.Class = "";
this.taskCheckBox.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.taskCheckBox.Location = new System.Drawing.Point(3, 10);
this.taskCheckBox.Name = "taskCheckBox";
this.taskCheckBox.Size = new System.Drawing.Size(75, 15);
this.taskCheckBox.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.taskCheckBox.TabIndex = 10;
this.taskCheckBox.Text = "Check-box";
//
// footerPanel
//
this.footerPanel.CanvasColor = System.Drawing.SystemColors.Control;
this.footerPanel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.footerPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.footerPanel.Location = new System.Drawing.Point(3, 40);
this.footerPanel.Name = "footerPanel";
this.footerPanel.Size = new System.Drawing.Size(500, 30);
this.footerPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
this.footerPanel.Style.Border = DevComponents.DotNetBar.eBorderType.Raised;
this.footerPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
this.footerPanel.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.Top;
this.footerPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.footerPanel.Style.GradientAngle = 90;
this.footerPanel.TabIndex = 10;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.buttonClose);
this.flowLayoutPanel1.Controls.Add(this.buttonCancel);
this.flowLayoutPanel1.Controls.Add(this.buttonOk);
this.flowLayoutPanel1.Controls.Add(this.buttonRetry);
this.flowLayoutPanel1.Controls.Add(this.buttonNo);
this.flowLayoutPanel1.Controls.Add(this.buttonYes);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(500, 35);
this.flowLayoutPanel1.TabIndex = 0;
this.flowLayoutPanel1.WrapContents = false;
//
// buttonClose
//
this.buttonClose.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonClose.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.buttonClose.Location = new System.Drawing.Point(436, 5);
this.buttonClose.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.buttonClose.Name = "buttonClose";
this.buttonClose.Size = new System.Drawing.Size(61, 24);
this.buttonClose.MinimumSize = new System.Drawing.Size(61, 24);
this.buttonClose.AutoSize = true;
this.buttonClose.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.buttonClose.TabIndex = 5;
this.buttonClose.Text = "&Close";
this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
//
// buttonRetry
//
this.buttonRetry.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonRetry.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.buttonRetry.Location = new System.Drawing.Point(369, 5);
this.buttonRetry.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.buttonRetry.Name = "buttonRetry";
this.buttonRetry.Size = new System.Drawing.Size(61, 24);
this.buttonRetry.MinimumSize = new System.Drawing.Size(61, 24);
this.buttonRetry.AutoSize = true;
this.buttonRetry.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.buttonRetry.TabIndex = 4;
this.buttonRetry.Text = "&Retry";
this.buttonRetry.Click += new System.EventHandler(this.buttonRetry_Click);
//
// buttonCancel
//
this.buttonCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.buttonCancel.Location = new System.Drawing.Point(302, 5);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(61, 24);
this.buttonCancel.MinimumSize = new System.Drawing.Size(61, 24);
this.buttonCancel.AutoSize = true;
this.buttonCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "&Cancel";
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// buttonOk
//
this.buttonOk.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonOk.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.buttonOk.Location = new System.Drawing.Point(235, 5);
this.buttonOk.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(61, 24);
this.buttonOk.MinimumSize = new System.Drawing.Size(61, 24);
this.buttonOk.AutoSize = true;
this.buttonOk.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.buttonOk.TabIndex = 2;
this.buttonOk.Text = "&OK";
this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click);
//
// buttonNo
//
this.buttonNo.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonNo.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.buttonNo.Location = new System.Drawing.Point(168, 5);
this.buttonNo.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.buttonNo.Name = "buttonNo";
this.buttonNo.Size = new System.Drawing.Size(61, 24);
this.buttonNo.MinimumSize = new System.Drawing.Size(61, 24);
this.buttonNo.AutoSize = true;
this.buttonNo.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.buttonNo.TabIndex = 1;
this.buttonNo.Text = "&No";
this.buttonNo.Click += new System.EventHandler(this.buttonNo_Click);
//
// buttonYes
//
this.buttonYes.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonYes.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.buttonYes.Location = new System.Drawing.Point(101, 5);
this.buttonYes.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3);
this.buttonYes.Name = "buttonYes";
this.buttonYes.Size = new System.Drawing.Size(61, 24);
this.buttonYes.MinimumSize = new System.Drawing.Size(61, 24);
this.buttonYes.AutoSize = true;
this.buttonYes.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.buttonYes.TabIndex = 0;
this.buttonYes.Text = "&Yes";
this.buttonYes.Click += new System.EventHandler(this.buttonYes_Click);
//
// TaskDialogForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(506, 310);
this.Controls.Add(this.bottomPanel);
this.Controls.Add(this.buttonsPanel);
this.Controls.Add(this.contentLabel);
this.Controls.Add(this.headerLabel);
this.Controls.Add(this.headerImage);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TaskDialogForm";
this.Text = "DotNetBar Task Dialog";
this.Load += new System.EventHandler(this.TaskDialogForm_Load);
((System.ComponentModel.ISupportInitialize)(this.headerImage)).EndInit();
this.bottomPanel.ResumeLayout(false);
this.bottomPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.footerImage)).EndInit();
this.flowLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox headerImage;
private LabelX headerLabel;
private LabelX contentLabel;
private ItemPanel buttonsPanel;
private PanelEx bottomPanel;
private ButtonX buttonOk;
private ButtonX buttonClose;
private ButtonX buttonRetry;
private ButtonX buttonCancel;
private ButtonX buttonNo;
private ButtonX buttonYes;
private DevComponents.DotNetBar.Controls.CheckBoxX taskCheckBox;
private LabelX footerLabel;
private System.Windows.Forms.PictureBox footerImage;
private PanelEx footerPanel;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}

View File

@@ -0,0 +1,495 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Rendering;
namespace DevComponents.DotNetBar
{
internal partial class TaskDialogForm : DevComponents.DotNetBar.OfficeForm
{
public TaskDialogForm()
{
InitializeComponent();
Office2007ColorTable table = ((Office2007Renderer)GlobalManager.Renderer).ColorTable;
bottomPanel.Style.BackColor1.Color = table.Form.BackColor;
headerLabel.MarkupLinkClick += new MarkupLinkClickEventHandler(MarkupLinkClick);
contentLabel.MarkupLinkClick += new MarkupLinkClickEventHandler(MarkupLinkClick);
footerLabel.MarkupLinkClick += new MarkupLinkClickEventHandler(MarkupLinkClick);
this.ShowInTaskbar = false;
}
private void MarkupLinkClick(object sender, MarkupLinkClickEventArgs e)
{
TaskDialog.InvokeMarkupLinkClick(sender, e);
}
private void TaskDialogForm_Load(object sender, EventArgs e)
{
}
private eTaskDialogBackgroundColor _TaskBackgroundColor = eTaskDialogBackgroundColor.Default;
/// <summary>
/// Gets or sets the task-background color.
/// </summary>
[DefaultValue(eTaskDialogBackgroundColor.Default)]
public eTaskDialogBackgroundColor TaskBackgroundColor
{
get { return _TaskBackgroundColor; }
set { _TaskBackgroundColor = value; }
}
private eTaskDialogButton _DefaultButton = eTaskDialogButton.Yes;
private static readonly int MinimumWidth = 420;
private static readonly int MinimumHeight = 200;
public eTaskDialogResult ShowTaskDialog(IWin32Window owner, TaskDialogInfo dialogInfo)
{
if (owner != null)
this.StartPosition = FormStartPosition.CenterParent;
else
this.StartPosition = FormStartPosition.CenterScreen;
UpdateDialogColor(dialogInfo);
int dialogButtonsWidth = Dpi.Width20;
int footerWidth = 0;
int contentHeight = Dpi.Height32;
this.Text = dialogInfo.Title;
headerLabel.Text = dialogInfo.Header;
contentLabel.Text = dialogInfo.Text;
_DefaultButton = dialogInfo.DefaultButton;
if (dialogInfo.TaskDialogIcon == eTaskDialogIcon.None)
{
int diff = this.Width - headerLabel.Right;
headerLabel.Left = headerImage.Left;
headerLabel.Width = this.Width - diff - headerLabel.Left;
diff = this.Width - contentLabel.Right;
contentLabel.Left = headerImage.Left;
contentLabel.Width = this.Width - diff - contentLabel.Left;
diff = this.Width - buttonsPanel.Right;
buttonsPanel.Left = headerImage.Left;
buttonsPanel.Width = this.Width - diff - buttonsPanel.Left;
headerImage.Visible = false;
}
else
headerImage.Image = TaskDialog.GetImage(dialogInfo.TaskDialogIcon);
if (dialogInfo.CheckBoxCommand != null)
{
taskCheckBox.Command = dialogInfo.CheckBoxCommand;
//taskCheckBox.Checked = dialogInfo.CheckBoxCommand.Checked;
dialogButtonsWidth += taskCheckBox.Width + Dpi.Width12;
}
else
taskCheckBox.Visible = false;
if (!string.IsNullOrEmpty(dialogInfo.FooterText))
{
footerLabel.Text = dialogInfo.FooterText;
footerWidth += footerLabel.Width + Dpi.Width12;
}
else
footerLabel.Visible = false;
if (dialogInfo.FooterImage != null)
{
footerImage.Image = dialogInfo.FooterImage;
footerWidth += footerImage.Width;
}
else
{
footerImage.Visible = false;
footerLabel.Left = footerImage.Left;
}
if (dialogInfo.RadioButtons != null && dialogInfo.RadioButtons.Length > 0)
{
foreach (Command command in dialogInfo.RadioButtons)
{
CheckBoxItem item = new CheckBoxItem();
item.CheckBoxStyle = eCheckBoxStyle.RadioButton;
//item.Checked = command.Checked;
item.Command = command;
buttonsPanel.Items.Add(item);
}
}
if (dialogInfo.Buttons != null && dialogInfo.Buttons.Length > 0)
{
foreach (Command command in dialogInfo.Buttons)
{
ButtonItem item = new ButtonItem();
if (command.Image != null)
{
item.ButtonStyle = eButtonStyle.ImageAndText;
item.ImagePosition = eImagePosition.Left;
}
item.Command = command;
buttonsPanel.Items.Add(item);
ButtonItemLayout.LayoutButton(item);
footerWidth = Math.Max(footerWidth, item.WidthInternal + buttonsPanel.Left * 2);
}
}
if ((dialogInfo.DialogButtons & eTaskDialogButton.Ok) == 0)
{
buttonOk.Visible = false;
}
else
{
dialogButtonsWidth += buttonOk.Width + 3;
if (dialogInfo.DefaultButton == eTaskDialogButton.Ok)
this.AcceptButton = buttonOk;
}
if ((dialogInfo.DialogButtons & eTaskDialogButton.Cancel) == 0)
{
buttonCancel.Visible = false;
}
else
{
dialogButtonsWidth += buttonCancel.Width + 3;
this.CancelButton = buttonCancel;
if (dialogInfo.DefaultButton == eTaskDialogButton.Cancel)
this.AcceptButton = buttonCancel;
}
if ((dialogInfo.DialogButtons & eTaskDialogButton.Yes) == 0)
{
buttonYes.Visible = false;
}
else
{
dialogButtonsWidth += buttonYes.Width + 3;
if (dialogInfo.DefaultButton == eTaskDialogButton.Yes)
this.AcceptButton = buttonYes;
}
if ((dialogInfo.DialogButtons & eTaskDialogButton.No) == 0)
{
buttonNo.Visible = false;
}
else
{
dialogButtonsWidth += buttonNo.Width + 3;
if (this.CancelButton == null)
this.CancelButton = buttonNo;
if (dialogInfo.DefaultButton == eTaskDialogButton.No)
this.AcceptButton = buttonNo;
}
if ((dialogInfo.DialogButtons & eTaskDialogButton.Close) == 0)
{
buttonClose.Visible = false;
}
else
{
dialogButtonsWidth += buttonClose.Width + 3;
if (this.CancelButton == null)
this.CancelButton = buttonClose;
else if (dialogInfo.DefaultButton == eTaskDialogButton.Close)
this.AcceptButton = buttonClose;
}
if ((dialogInfo.DialogButtons & eTaskDialogButton.Retry) == 0)
{
buttonRetry.Visible = false;
}
else
{
dialogButtonsWidth += buttonRetry.Width + Dpi.Width3;
if (dialogInfo.DefaultButton == eTaskDialogButton.Retry)
this.AcceptButton = buttonRetry;
}
// If only OK button is visible it is cancel button as well
if (dialogInfo.DialogButtons == eTaskDialogButton.Ok)
this.CancelButton = buttonOk;
if (string.IsNullOrEmpty(dialogInfo.FooterText) && dialogInfo.FooterImage == null)
{
footerPanel.Visible = false;
bottomPanel.Height = flowLayoutPanel1.Height + Dpi.Height4;
}
else
contentHeight += footerImage.Height;
this.Width = Math.Max(Dpi.Width(MinimumWidth), Math.Max(footerWidth, dialogButtonsWidth));
using (Graphics g = headerLabel.CreateGraphics()) { }
headerLabel.MaximumSize=new Size(headerLabel.Width, 1000);
headerLabel.Height=headerLabel.GetPreferredSize(Size.Empty).Height;
contentHeight += headerLabel.Height + Dpi.Height3;
//float dpiY = 96f;
//using (Graphics g = contentLabel.CreateGraphics()) { dpiY = g.DpiY; }
contentLabel.Top = headerLabel.Bounds.Bottom + Dpi.Height3;
contentLabel.MaximumSize = new Size(contentLabel.Width, 1000);
using (Graphics g = contentLabel.CreateGraphics()) { } // Force handle creation
contentLabel.Height = contentLabel.GetPreferredSize(Size.Empty).Height; // * (dpiY >= 120f ? 1.05 : 1));
contentHeight += contentLabel.Height + Dpi.Height6;
if (contentLabel.IsUsingTextMarkup)
contentHeight += Dpi.Height8;
buttonsPanel.Top = contentLabel.Bottom + Dpi.Height3;
if (buttonsPanel.Items.Count == 0)
{
buttonsPanel.Visible = false;
}
else
{
using (Graphics g = buttonsPanel.CreateGraphics()) { }
buttonsPanel.Height = buttonsPanel.GetAutoSizeHeight() + Dpi.Height2;
contentHeight += buttonsPanel.Height + Dpi.Height6;
if (string.IsNullOrEmpty(dialogInfo.FooterText) && dialogInfo.FooterImage == null)
contentHeight += Dpi.Height8;
}
contentHeight += bottomPanel.Height;
this.Height = Math.Max(Dpi.Height(MinimumHeight), contentHeight);
if (dialogInfo.TaskDialogIcon == eTaskDialogIcon.Help)
System.Media.SystemSounds.Question.Play();
else if (dialogInfo.TaskDialogIcon == eTaskDialogIcon.Information)
System.Media.SystemSounds.Asterisk.Play();
else
System.Media.SystemSounds.Exclamation.Play();
LocalizeText();
ShowDialog(owner);
return _Result;
}
protected override void OnShown(EventArgs e)
{
if (_DefaultButton == eTaskDialogButton.Cancel && buttonCancel.Visible)
buttonCancel.Focus();
else if (_DefaultButton == eTaskDialogButton.Close && buttonClose.Visible)
buttonClose.Focus();
else if (_DefaultButton == eTaskDialogButton.No && buttonNo.Visible)
buttonNo.Focus();
else if (_DefaultButton == eTaskDialogButton.Ok && buttonOk.Visible)
buttonOk.Focus();
else if (_DefaultButton == eTaskDialogButton.Retry && buttonRetry.Visible)
buttonRetry.Focus();
else if (_DefaultButton == eTaskDialogButton.Yes && buttonYes.Visible)
buttonYes.Focus();
base.OnShown(e);
}
private void LocalizeText()
{
buttonCancel.Text = LocalizationManager.GetLocalizedString(LocalizationKeys.MessageBoxCancelButton, buttonCancel.Text);
buttonClose.Text = LocalizationManager.GetLocalizedString(LocalizationKeys.MessageBoxCloseButton, buttonClose.Text);
buttonNo.Text = LocalizationManager.GetLocalizedString(LocalizationKeys.MessageBoxNoButton, buttonNo.Text);
buttonOk.Text = LocalizationManager.GetLocalizedString(LocalizationKeys.MessageBoxOkButton, buttonOk.Text);
buttonRetry.Text = LocalizationManager.GetLocalizedString(LocalizationKeys.MessageBoxRetryButton, buttonRetry.Text);
buttonYes.Text = LocalizationManager.GetLocalizedString(LocalizationKeys.MessageBoxYesButton, buttonYes.Text);
}
private void UpdateDialogColor(TaskDialogInfo dialogInfo)
{
eTaskDialogBackgroundColor color = dialogInfo.DialogColor;
if (StyleManager.IsMetro(StyleManager.Style))
color = eTaskDialogBackgroundColor.Default;
if (color == eTaskDialogBackgroundColor.Aqua)
{
//this.BackColor = ColorScheme.GetColor(0xDBEEF3);
bottomPanel.Style.BackColor1.Color = ColorScheme.GetColor(0xDBEEF3);
headerLabel.ForeColor = ColorScheme.GetColor(0x205867);
contentLabel.ForeColor = ColorScheme.GetColor(0x205867);
}
else if (color == eTaskDialogBackgroundColor.Blue)
{
bottomPanel.Style.BackColor1.Color = ColorScheme.GetColor(0xDBE5F1);
headerLabel.ForeColor = ColorScheme.GetColor(0x244061);
contentLabel.ForeColor = ColorScheme.GetColor(0x244061);
}
else if (color == eTaskDialogBackgroundColor.DarkBlue)
{
bottomPanel.Style.BackColor1.Color = ColorScheme.GetColor(0xC6D9F0);
headerLabel.ForeColor = ColorScheme.GetColor(0x0F243E);
contentLabel.ForeColor = ColorScheme.GetColor(0x0F243E);
}
else if (color == eTaskDialogBackgroundColor.OliveGreen)
{
bottomPanel.Style.BackColor1.Color = ColorScheme.GetColor(0xEBF1DD);
headerLabel.ForeColor = ColorScheme.GetColor(0x4F6128);
contentLabel.ForeColor = ColorScheme.GetColor(0x4F6128);
}
else if (color == eTaskDialogBackgroundColor.Orange)
{
bottomPanel.Style.BackColor1.Color = ColorScheme.GetColor(0xFDEADA);
headerLabel.ForeColor = ColorScheme.GetColor(0x974806);
contentLabel.ForeColor = ColorScheme.GetColor(0x974806);
}
else if (color == eTaskDialogBackgroundColor.Purple)
{
bottomPanel.Style.BackColor1.Color = ColorScheme.GetColor(0xE5E0EC);
headerLabel.ForeColor = ColorScheme.GetColor(0x3F3151);
contentLabel.ForeColor = ColorScheme.GetColor(0x3F3151);
}
else if (color == eTaskDialogBackgroundColor.Red)
{
bottomPanel.Style.BackColor1.Color = ColorScheme.GetColor(0xF2DCDB);
headerLabel.ForeColor = ColorScheme.GetColor(0x632423);
contentLabel.ForeColor = ColorScheme.GetColor(0x632423);
}
else if (color == eTaskDialogBackgroundColor.Silver)
{
bottomPanel.Style.BackColor1.Color = ColorScheme.GetColor(0xF2F2F2);
headerLabel.ForeColor = ColorScheme.GetColor(0x0C0C0C);
contentLabel.ForeColor = ColorScheme.GetColor(0x0C0C0C);
}
else if (color == eTaskDialogBackgroundColor.Tan)
{
bottomPanel.Style.BackColor1.Color = ColorScheme.GetColor(0xDDD9C3);
headerLabel.ForeColor = ColorScheme.GetColor(0x1D1B10);
contentLabel.ForeColor = ColorScheme.GetColor(0x1D1B10);
}
if (color != eTaskDialogBackgroundColor.Default)
{
bottomPanel.Style.BorderColor.Color = headerLabel.ForeColor;
}
if (StyleManager.IsMetro(StyleManager.Style))
{
this.BackColor = ((Office2007Renderer)GlobalManager.Renderer).ColorTable.Form.BackColor;
//bottomPanel.Style.BackColor1.Color = this.BackColor;
}
}
private eTaskDialogResult _Result = eTaskDialogResult.None;
/// <summary>
/// Gets the task-dialog result
/// </summary>
public eTaskDialogResult Result
{
get { return _Result; }
}
private bool _AntiAlias = true;
/// <summary>
/// Gets or sets the anti-alias text-rendering setting for the controls.
/// </summary>
public bool AntiAlias
{
get { return _AntiAlias; }
set
{
_AntiAlias = value;
headerLabel.AntiAlias = value;
contentLabel.AntiAlias = value;
buttonsPanel.AntiAlias = value;
buttonOk.AntiAlias = value;
buttonCancel.AntiAlias = value;
buttonYes.AntiAlias = value;
buttonNo.AntiAlias = value;
buttonRetry.AntiAlias = value;
footerLabel.AntiAlias = value;
taskCheckBox.AntiAlias = value;
}
}
private void buttonOk_Click(object sender, EventArgs e)
{
CloseDialog(eTaskDialogResult.Ok);
}
private void buttonYes_Click(object sender, EventArgs e)
{
CloseDialog(eTaskDialogResult.Yes);
}
private void buttonNo_Click(object sender, EventArgs e)
{
CloseDialog(eTaskDialogResult.No);
}
private void buttonCancel_Click(object sender, EventArgs e)
{
CloseDialog(eTaskDialogResult.Cancel);
}
private void buttonRetry_Click(object sender, EventArgs e)
{
CloseDialog(eTaskDialogResult.Retry);
}
private void buttonClose_Click(object sender, EventArgs e)
{
CloseDialog(eTaskDialogResult.Close);
}
internal void CloseDialog(eTaskDialogResult result)
{
_Result = result;
this.Close();
}
}
/// <summary>
/// Defines TaskDialog colors.
/// </summary>
public enum eTaskDialogBackgroundColor
{
/// <summary>
/// Task dialog will use default background as specified by current theme.
/// </summary>
Default,
/// <summary>
/// Task dialog will use silver background color.
/// </summary>
Silver,
/// <summary>
/// Task dialog will use tan background color.
/// </summary>
Tan,
/// <summary>
/// Task dialog will use dark-blue background color.
/// </summary>
DarkBlue,
/// <summary>
/// Task dialog will use blue background color.
/// </summary>
Blue,
/// <summary>
/// Task dialog will use red background color.
/// </summary>
Red,
/// <summary>
/// Task dialog will use olive-green background color.
/// </summary>
OliveGreen,
/// <summary>
/// Task dialog will use purple background color.
/// </summary>
Purple,
/// <summary>
/// Task dialog will use aqua background color.
/// </summary>
Aqua,
/// <summary>
/// Task dialog will use orange background color.
/// </summary>
Orange
}
}