diff --git a/DarkUI/Controls/DarkContextMenu.cs b/DarkUI/Controls/DarkContextMenu.cs
new file mode 100644
index 0000000..7e66090
--- /dev/null
+++ b/DarkUI/Controls/DarkContextMenu.cs
@@ -0,0 +1,16 @@
+using System.Windows.Forms;
+
+namespace DarkUI
+{
+ public class DarkContextMenu : ContextMenuStrip
+ {
+ #region Constructor Region
+
+ public DarkContextMenu()
+ {
+ Renderer = new DarkMenuRenderer();
+ }
+
+ #endregion
+ }
+}
diff --git a/DarkUI/Controls/DarkSectionPanel.cs b/DarkUI/Controls/DarkSectionPanel.cs
new file mode 100644
index 0000000..769a27c
--- /dev/null
+++ b/DarkUI/Controls/DarkSectionPanel.cs
@@ -0,0 +1,145 @@
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace DarkUI
+{
+ public class DarkSectionPanel : Panel
+ {
+ #region Field Region
+
+ private string _sectionHeader;
+
+ #endregion
+
+ #region Property Region
+
+ [Browsable(false)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public new Padding Padding
+ {
+ get { return base.Padding; }
+ }
+
+ [Category("Appearance")]
+ [Description("The section header text associated with this control.")]
+ public string SectionHeader
+ {
+ get { return _sectionHeader; }
+ set
+ {
+ _sectionHeader = value;
+ Invalidate();
+ }
+ }
+
+ #endregion
+
+ #region Constructor Region
+
+ public DarkSectionPanel()
+ {
+ SetStyle(ControlStyles.OptimizedDoubleBuffer |
+ ControlStyles.ResizeRedraw |
+ ControlStyles.UserPaint, true);
+
+ base.Padding = new Padding(1, 25, 1, 1);
+ }
+
+ #endregion
+
+ #region Event Handler Region
+
+ protected override void OnEnter(System.EventArgs e)
+ {
+ base.OnEnter(e);
+
+ Invalidate();
+ }
+
+ protected override void OnLeave(System.EventArgs e)
+ {
+ base.OnLeave(e);
+
+ Invalidate();
+ }
+
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ base.OnMouseDown(e);
+
+ if (Controls.Count > 0)
+ Controls[0].Focus();
+ }
+
+ #endregion
+
+ #region Paint Region
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ var g = e.Graphics;
+ var rect = ClientRectangle;
+
+ // Fill body
+ using (var b = new SolidBrush(Colors.GreyBackground))
+ {
+ g.FillRectangle(b, rect);
+ }
+
+ // Draw header
+ var bgColor = ContainsFocus ? Colors.BlueBackground : Colors.HeaderBackground;
+ var darkColor = ContainsFocus ? Colors.DarkBlueBorder : Colors.DarkBorder;
+ var lightColor = ContainsFocus ? Colors.LightBlueBorder : Colors.LightBorder;
+
+ using (var b = new SolidBrush(bgColor))
+ {
+ var bgRect = new Rectangle(0, 0, rect.Width, 25);
+ g.FillRectangle(b, bgRect);
+ }
+
+ using (var p = new Pen(darkColor))
+ {
+ g.DrawLine(p, rect.Left, 0, rect.Right, 0);
+ g.DrawLine(p, rect.Left, 25 - 1, rect.Right, 25 - 1);
+ }
+
+ using (var p = new Pen(lightColor))
+ {
+ g.DrawLine(p, rect.Left, 1, rect.Right, 1);
+ }
+
+ var xOffset = 3;
+
+ using (var b = new SolidBrush(Colors.LightText))
+ {
+ var textRect = new Rectangle(xOffset, 0, rect.Width - 4 - xOffset, 25);
+
+ var format = new StringFormat
+ {
+ Alignment = StringAlignment.Near,
+ LineAlignment = StringAlignment.Center,
+ FormatFlags = StringFormatFlags.NoWrap,
+ Trimming = StringTrimming.EllipsisCharacter
+ };
+
+ g.DrawString(SectionHeader, Font, b, textRect, format);
+ }
+
+ // Draw border
+ using (var p = new Pen(Colors.DarkBorder, 1))
+ {
+ var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1);
+
+ g.DrawRectangle(p, modRect);
+ }
+ }
+
+ protected override void OnPaintBackground(PaintEventArgs e)
+ {
+ // Absorb event
+ }
+
+ #endregion
+ }
+}
diff --git a/DarkUI/DarkUI.csproj b/DarkUI/DarkUI.csproj
index a2ee4ec..2516111 100644
--- a/DarkUI/DarkUI.csproj
+++ b/DarkUI/DarkUI.csproj
@@ -44,6 +44,9 @@
Component
+
+ Component
+
Component
@@ -53,6 +56,9 @@
Component
+
+ Component
+
Component
diff --git a/Example/Forms/MainForm.Designer.cs b/Example/Forms/MainForm.Designer.cs
index fcd6887..f19fd8c 100644
--- a/Example/Forms/MainForm.Designer.cs
+++ b/Example/Forms/MainForm.Designer.cs
@@ -78,10 +78,17 @@
this.toolStripStatusLabel6 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel();
this.btnDialog = new DarkUI.DarkButton();
+ this.darkSectionPanel1 = new DarkUI.DarkSectionPanel();
this.btnMessageBox = new DarkUI.DarkButton();
+ this.darkContextMenu1 = new DarkUI.DarkContextMenu();
+ this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.moreTestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.test3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuMain.SuspendLayout();
this.toolMain.SuspendLayout();
this.darkStatusStrip1.SuspendLayout();
+ this.darkSectionPanel1.SuspendLayout();
+ this.darkContextMenu1.SuspendLayout();
this.SuspendLayout();
//
// mnuMain
@@ -549,21 +556,63 @@
this.btnDialog.TabIndex = 3;
this.btnDialog.Text = "Dialog";
//
+ // darkSectionPanel1
+ //
+ this.darkSectionPanel1.Controls.Add(this.btnMessageBox);
+ this.darkSectionPanel1.Location = new System.Drawing.Point(431, 157);
+ this.darkSectionPanel1.Name = "darkSectionPanel1";
+ this.darkSectionPanel1.SectionHeader = "Section test";
+ this.darkSectionPanel1.Size = new System.Drawing.Size(221, 224);
+ this.darkSectionPanel1.TabIndex = 5;
+ //
// btnMessageBox
//
- this.btnMessageBox.Location = new System.Drawing.Point(128, 73);
+ this.btnMessageBox.ContextMenuStrip = this.darkContextMenu1;
+ this.btnMessageBox.Location = new System.Drawing.Point(10, 35);
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.TabIndex = 5;
this.btnMessageBox.Text = "Message Box";
//
+ // darkContextMenu1
+ //
+ this.darkContextMenu1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
+ this.darkContextMenu1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
+ this.darkContextMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.testToolStripMenuItem,
+ this.moreTestToolStripMenuItem,
+ this.test3ToolStripMenuItem});
+ this.darkContextMenu1.Name = "darkContextMenu1";
+ this.darkContextMenu1.Size = new System.Drawing.Size(125, 70);
+ //
+ // testToolStripMenuItem
+ //
+ this.testToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
+ this.testToolStripMenuItem.Name = "testToolStripMenuItem";
+ this.testToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.testToolStripMenuItem.Text = "Test";
+ //
+ // moreTestToolStripMenuItem
+ //
+ this.moreTestToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
+ this.moreTestToolStripMenuItem.Name = "moreTestToolStripMenuItem";
+ this.moreTestToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
+ this.moreTestToolStripMenuItem.Text = "More test";
+ //
+ // test3ToolStripMenuItem
+ //
+ this.test3ToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
+ this.test3ToolStripMenuItem.Name = "test3ToolStripMenuItem";
+ this.test3ToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
+ this.test3ToolStripMenuItem.Text = "Test 3";
+ //
// 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.darkSectionPanel1);
this.Controls.Add(this.btnDialog);
this.Controls.Add(this.darkStatusStrip1);
this.Controls.Add(this.toolMain);
@@ -580,6 +629,8 @@
this.toolMain.PerformLayout();
this.darkStatusStrip1.ResumeLayout(false);
this.darkStatusStrip1.PerformLayout();
+ this.darkSectionPanel1.ResumeLayout(false);
+ this.darkContextMenu1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -636,7 +687,12 @@
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel6;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel5;
private DarkUI.DarkButton btnDialog;
+ private DarkUI.DarkSectionPanel darkSectionPanel1;
private DarkUI.DarkButton btnMessageBox;
+ private DarkUI.DarkContextMenu darkContextMenu1;
+ private System.Windows.Forms.ToolStripMenuItem testToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem moreTestToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem test3ToolStripMenuItem;
}
}
diff --git a/Example/Forms/MainForm.resx b/Example/Forms/MainForm.resx
index 29eac64..9271f3a 100644
--- a/Example/Forms/MainForm.resx
+++ b/Example/Forms/MainForm.resx
@@ -357,4 +357,7 @@
257, 17
+
+ 398, 17
+
\ No newline at end of file