From 27a5ad0c6e88393aa21e73e714d6c04ca5c84d3e Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 18 Sep 2015 11:40:14 +0100 Subject: [PATCH] DarkDialog & DarkMessageBox Added a dynamic dialog window and message box. --- DarkUI/Config/Enums.cs | 19 +++ DarkUI/Controls/DarkLabel.cs | 3 - DarkUI/DarkUI.csproj | 38 +++++ DarkUI/Forms/DarkDialog.Designer.cs | 186 +++++++++++++++++++++++ DarkUI/Forms/DarkDialog.cs | 162 ++++++++++++++++++++ DarkUI/Forms/DarkDialog.resx | 120 +++++++++++++++ DarkUI/Forms/DarkMessageBox.Designer.cs | 81 ++++++++++ DarkUI/Forms/DarkMessageBox.cs | 149 ++++++++++++++++++ DarkUI/Forms/DarkMessageBox.resx | 120 +++++++++++++++ DarkUI/Icons/MessageBoxIcons.Designer.cs | 93 ++++++++++++ DarkUI/Icons/MessageBoxIcons.resx | 130 ++++++++++++++++ DarkUI/Resources/error.png | Bin 0 -> 745 bytes DarkUI/Resources/info.png | Bin 0 -> 629 bytes DarkUI/Resources/warning.png | Bin 0 -> 431 bytes Example/Forms/MainForm.Designer.cs | 25 ++- Example/Forms/MainForm.cs | 14 +- 16 files changed, 1135 insertions(+), 5 deletions(-) create mode 100644 DarkUI/Forms/DarkDialog.Designer.cs create mode 100644 DarkUI/Forms/DarkDialog.cs create mode 100644 DarkUI/Forms/DarkDialog.resx create mode 100644 DarkUI/Forms/DarkMessageBox.Designer.cs create mode 100644 DarkUI/Forms/DarkMessageBox.cs create mode 100644 DarkUI/Forms/DarkMessageBox.resx create mode 100644 DarkUI/Icons/MessageBoxIcons.Designer.cs create mode 100644 DarkUI/Icons/MessageBoxIcons.resx create mode 100644 DarkUI/Resources/error.png create mode 100644 DarkUI/Resources/info.png create mode 100644 DarkUI/Resources/warning.png diff --git a/DarkUI/Config/Enums.cs b/DarkUI/Config/Enums.cs index 4e1029f..a09c523 100644 --- a/DarkUI/Config/Enums.cs +++ b/DarkUI/Config/Enums.cs @@ -25,4 +25,23 @@ Vertical, Horizontal } + + public enum DarkDialogButton + { + Ok, + Close, + OkCancel, + YesNo, + YesNoCancel, + AbortRetryIgnore, + RetryCancel + } + + public enum DarkMessageBoxIcon + { + None, + Information, + Warning, + Error + } } diff --git a/DarkUI/Controls/DarkLabel.cs b/DarkUI/Controls/DarkLabel.cs index 64ed4d7..6b88d4d 100644 --- a/DarkUI/Controls/DarkLabel.cs +++ b/DarkUI/Controls/DarkLabel.cs @@ -34,9 +34,6 @@ namespace DarkUI } } - [Category("Layout")] - [Description("Enables automatic resizing based on font size. Note that this is only valid for label controls that do not wrap text.")] - [DefaultValue(true)] public new bool AutoSize { get { return base.AutoSize; } diff --git a/DarkUI/DarkUI.csproj b/DarkUI/DarkUI.csproj index 4ba540f..a2ee4ec 100644 --- a/DarkUI/DarkUI.csproj +++ b/DarkUI/DarkUI.csproj @@ -35,6 +35,7 @@ + @@ -66,14 +67,31 @@ + + Form + + + DarkDialog.cs + Form + + Form + + + DarkMessageBox.cs + True True MenuIcons.resx + + True + True + MessageBoxIcons.resx + True True @@ -84,11 +102,22 @@ + + DarkDialog.cs + + + DarkMessageBox.cs + PublicResXFileCodeGenerator MenuIcons.Designer.cs DarkUI + + ResXFileCodeGenerator + MessageBoxIcons.Designer.cs + DarkUI + ResXFileCodeGenerator ScrollIcons.Designer.cs @@ -113,6 +142,15 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DarkUI/Forms/DarkMessageBox.Designer.cs b/DarkUI/Forms/DarkMessageBox.Designer.cs new file mode 100644 index 0000000..a285fd1 --- /dev/null +++ b/DarkUI/Forms/DarkMessageBox.Designer.cs @@ -0,0 +1,81 @@ +namespace DarkUI +{ + partial class DarkMessageBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.picIcon = new System.Windows.Forms.PictureBox(); + this.lblText = new DarkUI.DarkLabel(); + ((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit(); + this.SuspendLayout(); + // + // picIcon + // + this.picIcon.Location = new System.Drawing.Point(10, 10); + this.picIcon.Name = "picIcon"; + this.picIcon.Size = new System.Drawing.Size(32, 32); + this.picIcon.TabIndex = 3; + this.picIcon.TabStop = false; + // + // lblText + // + this.lblText.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); + this.lblText.Location = new System.Drawing.Point(50, 9); + this.lblText.Name = "lblText"; + this.lblText.Size = new System.Drawing.Size(185, 15); + this.lblText.TabIndex = 4; + this.lblText.Text = "Something something something"; + // + // DarkMessageBox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(244, 86); + this.Controls.Add(this.lblText); + this.Controls.Add(this.picIcon); + this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DarkMessageBox"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Message box"; + this.Controls.SetChildIndex(this.picIcon, 0); + this.Controls.SetChildIndex(this.lblText, 0); + ((System.ComponentModel.ISupportInitialize)(this.picIcon)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox picIcon; + private DarkLabel lblText; + } +} \ No newline at end of file diff --git a/DarkUI/Forms/DarkMessageBox.cs b/DarkUI/Forms/DarkMessageBox.cs new file mode 100644 index 0000000..6cf7d57 --- /dev/null +++ b/DarkUI/Forms/DarkMessageBox.cs @@ -0,0 +1,149 @@ +using System; +using System.ComponentModel; +using System.Drawing; + +namespace DarkUI +{ + public partial class DarkMessageBox : DarkDialog + { + #region Field Region + + private string _message; + private int _maximumWidth = 350; + + #endregion + + #region Property Region + + [Description("Determines the maximum width of the message box when it autosizes around the displayed message.")] + [DefaultValue(350)] + public int MaximumWidth + { + get { return _maximumWidth; } + set + { + _maximumWidth = value; + CalculateSize(); + } + } + + #endregion + + #region Constructor Region + + public DarkMessageBox() + { + InitializeComponent(); + } + + public DarkMessageBox(string message, string title, DarkMessageBoxIcon icon, DarkDialogButton buttons) + : this() + { + var offsetHeight = Height - picIcon.Height; + + Text = title; + _message = message; + + DialogButtons = buttons; + SetIcon(icon); + } + + public DarkMessageBox(string message) + : this(message, null, DarkMessageBoxIcon.None, DarkDialogButton.Ok) + { } + + public DarkMessageBox(string message, string title) + : this(message, title, DarkMessageBoxIcon.None, DarkDialogButton.Ok) + { } + + public DarkMessageBox(string message, string title, DarkDialogButton buttons) + : this(message, title, DarkMessageBoxIcon.None, buttons) + { } + + public DarkMessageBox(string message, string title, DarkMessageBoxIcon icon) + : this(message, title, icon, DarkDialogButton.Ok) + { } + + #endregion + + #region Method Region + + private void SetIcon(DarkMessageBoxIcon icon) + { + switch (icon) + { + case DarkMessageBoxIcon.None: + picIcon.Visible = false; + lblText.Left = 10; + break; + case DarkMessageBoxIcon.Information: + picIcon.Image = MessageBoxIcons.info; + break; + case DarkMessageBoxIcon.Warning: + picIcon.Image = MessageBoxIcons.warning; + break; + case DarkMessageBoxIcon.Error: + picIcon.Image = MessageBoxIcons.error; + break; + } + } + + private void CalculateSize() + { + var width = 260; var height = 124; + + // Reset form back to original size + Size = new Size(width, height); + + lblText.Text = string.Empty; + lblText.AutoSize = true; + lblText.Text = _message; + + // Set the minimum dialog size to whichever is bigger - the original size or the buttons. + var minWidth = Math.Max(width, TotalButtonSize + 15); + + // Calculate the total size of the message + var totalWidth = lblText.Right + 25; + + // Make sure we're not making the dialog bigger than the maximum size + if (totalWidth < _maximumWidth) + { + // Width is smaller than the maximum width. + // This means we can have a single-line message box. + // Move the label to accomodate this. + width = totalWidth; + lblText.Top = picIcon.Top + (picIcon.Height / 2) - (lblText.Height / 2); + } + else + { + // Width is larger than the maximum width. + // Change the label size and wrap it. + width = _maximumWidth; + var offsetHeight = Height - picIcon.Height; + lblText.AutoUpdateHeight = true; + lblText.Width = width - lblText.Left - 25; + height = offsetHeight + lblText.Height; + } + + // Force the width to the minimum width + if (width < minWidth) + width = minWidth; + + // Set the new size of the dialog + Size = new Size(width, height); + } + + #endregion + + #region Event Handler Region + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + CalculateSize(); + } + + #endregion + } +} diff --git a/DarkUI/Forms/DarkMessageBox.resx b/DarkUI/Forms/DarkMessageBox.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DarkUI/Forms/DarkMessageBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DarkUI/Icons/MessageBoxIcons.Designer.cs b/DarkUI/Icons/MessageBoxIcons.Designer.cs new file mode 100644 index 0000000..7c94bba --- /dev/null +++ b/DarkUI/Icons/MessageBoxIcons.Designer.cs @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DarkUI { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MessageBoxIcons { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MessageBoxIcons() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DarkUI.Icons.MessageBoxIcons", typeof(MessageBoxIcons).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap error { + get { + object obj = ResourceManager.GetObject("error", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap info { + get { + object obj = ResourceManager.GetObject("info", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap warning { + get { + object obj = ResourceManager.GetObject("warning", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/DarkUI/Icons/MessageBoxIcons.resx b/DarkUI/Icons/MessageBoxIcons.resx new file mode 100644 index 0000000..3303bd4 --- /dev/null +++ b/DarkUI/Icons/MessageBoxIcons.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\info.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/DarkUI/Resources/error.png b/DarkUI/Resources/error.png new file mode 100644 index 0000000000000000000000000000000000000000..7d96891fa27bbd217eaaf4f688590a97911e0e27 GIT binary patch literal 745 zcmVM@}J%mp{SM^6XSlV`U{Ig=nF0L9|jV zL|aL#SR7g@k^?Oi3m;fn`A$JCuduMRv(1SH^aR}xc47VT;<#{-fn^EI&iC8d-O0RN z_MbMJ%~rxR2;)Q;eQUQSjEykrZnwK>z8L~M@M@T@g@J$)L%>=PvR*16fe(afl6L$1 z>z4g|{@AuZytQBN-|+kIK>L@ibL6-!9X@8e&s^Ylo|RD$^4SxR!v_)G12h}o2=FIX zU_r!r>)yJPgiND|T3OYcl)nJJ{pzJ{9X(hK$5_K!Vi1d%#BR%g?i_g7^-cTn=)UcQ z?YVd*WaDdgea7+=xX?3)o5Ap{ycbV#9z1GtU6;oZF6r!qbkJHE@w{dQmyEiWP1Ju-tZlnobR@aCbcnSTJE% zvAj}bOl|gbogpX@A#iWKum+u2+o^EYX49)9y;%BtE}XS$iN(`|-ASdE@*1sFL=jwA z{VKm8Vk$z@Sqv9eYbh=g;lq8aY+>dL@Sd9UItm5ww^D z#U74MrWDSFV-$%H)&>Gn7(y8|9=};VQyi4+9oV*y$3k zF=aiR2A&5m@&ybd+Bk2?=m}m^8fhB7T{_#APNx$3zWW|Nv!zp~!8Kv`C$$bBcZvf& zoR|ameTfMi1}v=uM&BMq&_Ifa9c@ZSuv9=2QD-7ZnOC5^fDP>(>~PCG!>wkIK*XP7klqMu-?Zn?1X@=S-}q&KKQaG`ZdHN<{~~$#|lRCr$PmoZBtK@@=B4kl>CRXpw*JxFu45zzx1BiPw&`~ipg z1%YcUtWsFm2&pU;e}K1*onTU`$mMFAfL^005-~~w>b%Dr7#?VLHJMoW!N7)O-uL$H z%;c>H5ot6U82||MnA0N*jG(MXMUOC*N>w2OUIg(n02K7dKs+#kl1^khb^c54rCc-exZixz#h@e>}*d`rO3uL)R6_v2@~DtVnqEm8t34_H2eqP6NB$zwoC ztY!vHA~&2w2mQQ9|Kek zCTCYd$!8u_{(E8=&VPN!LD#Qdi;k_*VypuA^Xfl#a1i;o;k z(JVsX*13%G_30t#5)>O9=+e$mo&$M3ZWhLp)WdZciixpJhy1~sQii|CoAt0c>%V7B z;9QJh$;G>YOu$+XIrBIU7DwN*J8%xpwacEv*gbwVbN_N$lqHw+{Pp}9Df|xz16L~| P00000NkvXXu0mjfEmIIw literal 0 HcmV?d00001 diff --git a/DarkUI/Resources/warning.png b/DarkUI/Resources/warning.png new file mode 100644 index 0000000000000000000000000000000000000000..6fbf0effcb85f267a68ac7179e4c7570c1a60ef5 GIT binary patch literal 431 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?4jBOuH;Rhv(mfq^m6 z)5S5QB5v>0{a(g_0!PowT|dO_v|-D|_6=Wsbtb7zeLo@M2Zvearq=v~WXUaCH*VZ6 zrXmpY=YQ>)NsYdnPtR?(EJ)l@VEp^{-J8CR4zG5}G0jLeUOXkJ^^CwqAFFSh4k`To zcXtv4PD`^|zwi z9eU%oJG_1OHFAO5`sf7xzps}0&QCpf?ptJneC^Mw)`T}X>siY#Zr;a!|D8bZ+^zRt zY=Wx>=>TDk#b5r*ebTLwxm(qL>if!zuf-(x{_dXnUocX3KC9b{>Dmded=pFWFl{|~ z{XU1=ySfehKF2>)$ZiU-vb`@qaq`I>kqaZ%-!Hipq0rD8dY}FI56L+X*C*Sqxo*Y1 zY>L~zxH`FWRdP=GdA8S9t|`Cxi|-60&&Jk@&%N&(X5UCFK3zYvRIo3CxpFEn1{geD L{an^LB{Ts5S`*2@ literal 0 HcmV?d00001 diff --git a/Example/Forms/MainForm.Designer.cs b/Example/Forms/MainForm.Designer.cs index bcdb59a..fcd6887 100644 --- a/Example/Forms/MainForm.Designer.cs +++ b/Example/Forms/MainForm.Designer.cs @@ -77,6 +77,8 @@ this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel6 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel(); + this.btnDialog = new DarkUI.DarkButton(); + this.btnMessageBox = new DarkUI.DarkButton(); this.mnuMain.SuspendLayout(); this.toolMain.SuspendLayout(); this.darkStatusStrip1.SuspendLayout(); @@ -538,16 +540,35 @@ this.toolStripStatusLabel5.Text = "120 MB"; this.toolStripStatusLabel5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // btnDialog + // + this.btnDialog.Location = new System.Drawing.Point(25, 73); + this.btnDialog.Name = "btnDialog"; + this.btnDialog.Padding = new System.Windows.Forms.Padding(5); + this.btnDialog.Size = new System.Drawing.Size(97, 30); + this.btnDialog.TabIndex = 3; + this.btnDialog.Text = "Dialog"; + // + // btnMessageBox + // + this.btnMessageBox.Location = new System.Drawing.Point(128, 73); + this.btnMessageBox.Name = "btnMessageBox"; + this.btnMessageBox.Padding = new System.Windows.Forms.Padding(5); + this.btnMessageBox.Size = new System.Drawing.Size(97, 30); + this.btnMessageBox.TabIndex = 4; + this.btnMessageBox.Text = "Message Box"; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(784, 562); + this.Controls.Add(this.btnMessageBox); + this.Controls.Add(this.btnDialog); this.Controls.Add(this.darkStatusStrip1); this.Controls.Add(this.toolMain); this.Controls.Add(this.mnuMain); this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MainMenuStrip = this.mnuMain; this.MinimumSize = new System.Drawing.Size(640, 480); this.Name = "MainForm"; @@ -614,6 +635,8 @@ private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel6; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel5; + private DarkUI.DarkButton btnDialog; + private DarkUI.DarkButton btnMessageBox; } } diff --git a/Example/Forms/MainForm.cs b/Example/Forms/MainForm.cs index 0ced87d..8f9f014 100644 --- a/Example/Forms/MainForm.cs +++ b/Example/Forms/MainForm.cs @@ -1,5 +1,4 @@ using DarkUI; -using System.Windows.Forms; namespace Example { @@ -8,6 +7,19 @@ namespace Example public MainForm() { InitializeComponent(); + + btnDialog.Click += delegate { + var msgBox = new DarkMessageBox("This is small", + "Dark UI Example", DarkMessageBoxIcon.Information, DarkDialogButton.AbortRetryIgnore); + msgBox.ShowDialog(); + }; + + btnMessageBox.Click += delegate { + var msgBox = new DarkMessageBox("This is a test of the dark message box. It's cool, isn't it? You can have really quite a lot of text in here and the message box will size itself appropriately. I dislike how the default .NET message box handled this, so hopefully this will be a better option for you. :)", + "Dark UI Example", DarkMessageBoxIcon.Information, DarkDialogButton.AbortRetryIgnore); + msgBox.MaximumWidth = 350; + msgBox.ShowDialog(); + }; } } }