Added DarkTitle control

This commit is contained in:
Robin 2015-12-07 18:36:43 +00:00
parent 029ea0774a
commit 4661e00705
3 changed files with 103 additions and 16 deletions

View File

@ -0,0 +1,40 @@
using DarkUI.Config;
using System.Drawing;
using System.Windows.Forms;
namespace DarkUI.Controls
{
public class DarkTitle : Label
{
#region Constructor Region
public DarkTitle()
{ }
#endregion
#region Paint Region
protected override void OnPaint(PaintEventArgs e)
{
var g = e.Graphics;
var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height);
var textSize = g.MeasureString(Text, Font);
using (var b = new SolidBrush(Colors.LightText))
{
g.DrawString(Text, Font, b, new PointF(-2, 0));
}
using (var p = new Pen(Colors.GreyHighlight))
{
var p1 = new PointF(textSize.Width + 5, textSize.Height / 2);
var p2 = new PointF(rect.Width, textSize.Height / 2);
g.DrawLine(p, p1, p2);
}
}
#endregion
}
}

View File

@ -49,6 +49,9 @@
<Compile Include="Controls\DarkRadioButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\DarkTitle.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\DarkTreeView.cs">
<SubType>Component</SubType>
</Compile>

View File

@ -43,13 +43,16 @@ namespace Example
this.darkRadioButton3 = new DarkUI.Controls.DarkRadioButton();
this.darkRadioButton2 = new DarkUI.Controls.DarkRadioButton();
this.darkRadioButton1 = new DarkUI.Controls.DarkRadioButton();
this.darkTitle3 = new DarkUI.Controls.DarkTitle();
this.panel4 = new System.Windows.Forms.Panel();
this.darkCheckBox2 = new DarkUI.Controls.DarkCheckBox();
this.darkCheckBox1 = new DarkUI.Controls.DarkCheckBox();
this.darkTitle2 = new DarkUI.Controls.DarkTitle();
this.panel3 = new System.Windows.Forms.Panel();
this.btnMessageBox = new DarkUI.Controls.DarkButton();
this.panel2 = new System.Windows.Forms.Panel();
this.btnDialog = new DarkUI.Controls.DarkButton();
this.darkTitle1 = new DarkUI.Controls.DarkTitle();
this.pnlMain.SuspendLayout();
this.tblMain.SuspendLayout();
this.pnlTreeView.SuspendLayout();
@ -105,6 +108,7 @@ namespace Example
this.treeTest.AllowMoveNodes = true;
this.treeTest.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeTest.Location = new System.Drawing.Point(1, 25);
this.treeTest.MaxDragChange = 20;
this.treeTest.MultiSelect = true;
this.treeTest.Name = "treeTest";
this.treeTest.ShowIcons = true;
@ -162,8 +166,9 @@ namespace Example
this.panel5.Controls.Add(this.darkRadioButton3);
this.panel5.Controls.Add(this.darkRadioButton2);
this.panel5.Controls.Add(this.darkRadioButton1);
this.panel5.Controls.Add(this.darkTitle3);
this.panel5.Dock = System.Windows.Forms.DockStyle.Top;
this.panel5.Location = new System.Drawing.Point(10, 147);
this.panel5.Location = new System.Drawing.Point(10, 190);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(200, 100);
this.panel5.TabIndex = 12;
@ -172,10 +177,11 @@ namespace Example
//
this.darkRadioButton3.AutoSize = true;
this.darkRadioButton3.Checked = true;
this.darkRadioButton3.Dock = System.Windows.Forms.DockStyle.Top;
this.darkRadioButton3.Enabled = false;
this.darkRadioButton3.Location = new System.Drawing.Point(0, 50);
this.darkRadioButton3.Location = new System.Drawing.Point(0, 64);
this.darkRadioButton3.Name = "darkRadioButton3";
this.darkRadioButton3.Size = new System.Drawing.Size(139, 19);
this.darkRadioButton3.Size = new System.Drawing.Size(200, 19);
this.darkRadioButton3.TabIndex = 4;
this.darkRadioButton3.TabStop = true;
this.darkRadioButton3.Text = "Disabled radio button";
@ -183,31 +189,43 @@ namespace Example
// darkRadioButton2
//
this.darkRadioButton2.AutoSize = true;
this.darkRadioButton2.Location = new System.Drawing.Point(0, 25);
this.darkRadioButton2.Dock = System.Windows.Forms.DockStyle.Top;
this.darkRadioButton2.Location = new System.Drawing.Point(0, 45);
this.darkRadioButton2.Name = "darkRadioButton2";
this.darkRadioButton2.Size = new System.Drawing.Size(94, 19);
this.darkRadioButton2.Size = new System.Drawing.Size(200, 19);
this.darkRadioButton2.TabIndex = 3;
this.darkRadioButton2.Text = "Radio button";
//
// darkRadioButton1
//
this.darkRadioButton1.AutoSize = true;
this.darkRadioButton1.Location = new System.Drawing.Point(0, 0);
this.darkRadioButton1.Dock = System.Windows.Forms.DockStyle.Top;
this.darkRadioButton1.Location = new System.Drawing.Point(0, 26);
this.darkRadioButton1.Name = "darkRadioButton1";
this.darkRadioButton1.Size = new System.Drawing.Size(94, 19);
this.darkRadioButton1.Size = new System.Drawing.Size(200, 19);
this.darkRadioButton1.TabIndex = 2;
this.darkRadioButton1.Text = "Radio button";
//
// darkTitle3
//
this.darkTitle3.Dock = System.Windows.Forms.DockStyle.Top;
this.darkTitle3.Location = new System.Drawing.Point(0, 0);
this.darkTitle3.Name = "darkTitle3";
this.darkTitle3.Size = new System.Drawing.Size(200, 26);
this.darkTitle3.TabIndex = 16;
this.darkTitle3.Text = "Radio buttons";
//
// panel4
//
this.panel4.AutoSize = true;
this.panel4.Controls.Add(this.darkCheckBox2);
this.panel4.Controls.Add(this.darkCheckBox1);
this.panel4.Controls.Add(this.darkTitle2);
this.panel4.Dock = System.Windows.Forms.DockStyle.Top;
this.panel4.Location = new System.Drawing.Point(10, 90);
this.panel4.Location = new System.Drawing.Point(10, 116);
this.panel4.Name = "panel4";
this.panel4.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10);
this.panel4.Size = new System.Drawing.Size(200, 57);
this.panel4.Size = new System.Drawing.Size(200, 74);
this.panel4.TabIndex = 11;
//
// darkCheckBox2
@ -215,28 +233,39 @@ namespace Example
this.darkCheckBox2.AutoSize = true;
this.darkCheckBox2.Checked = true;
this.darkCheckBox2.CheckState = System.Windows.Forms.CheckState.Checked;
this.darkCheckBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.darkCheckBox2.Enabled = false;
this.darkCheckBox2.Location = new System.Drawing.Point(0, 25);
this.darkCheckBox2.Location = new System.Drawing.Point(0, 45);
this.darkCheckBox2.Name = "darkCheckBox2";
this.darkCheckBox2.Size = new System.Drawing.Size(124, 19);
this.darkCheckBox2.Size = new System.Drawing.Size(200, 19);
this.darkCheckBox2.TabIndex = 13;
this.darkCheckBox2.Text = "Disabled checkbox";
//
// darkCheckBox1
//
this.darkCheckBox1.AutoSize = true;
this.darkCheckBox1.Location = new System.Drawing.Point(0, 0);
this.darkCheckBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.darkCheckBox1.Location = new System.Drawing.Point(0, 26);
this.darkCheckBox1.Name = "darkCheckBox1";
this.darkCheckBox1.Size = new System.Drawing.Size(121, 19);
this.darkCheckBox1.Size = new System.Drawing.Size(200, 19);
this.darkCheckBox1.TabIndex = 12;
this.darkCheckBox1.Text = "Enabled checkbox";
//
// darkTitle2
//
this.darkTitle2.Dock = System.Windows.Forms.DockStyle.Top;
this.darkTitle2.Location = new System.Drawing.Point(0, 0);
this.darkTitle2.Name = "darkTitle2";
this.darkTitle2.Size = new System.Drawing.Size(200, 26);
this.darkTitle2.TabIndex = 15;
this.darkTitle2.Text = "Check boxes";
//
// panel3
//
this.panel3.AutoSize = true;
this.panel3.Controls.Add(this.btnMessageBox);
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
this.panel3.Location = new System.Drawing.Point(10, 50);
this.panel3.Location = new System.Drawing.Point(10, 76);
this.panel3.Name = "panel3";
this.panel3.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10);
this.panel3.Size = new System.Drawing.Size(200, 40);
@ -254,23 +283,35 @@ namespace Example
//
// panel2
//
this.panel2.AutoSize = true;
this.panel2.Controls.Add(this.btnDialog);
this.panel2.Controls.Add(this.darkTitle1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(10, 10);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(200, 40);
this.panel2.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10);
this.panel2.Size = new System.Drawing.Size(200, 66);
this.panel2.TabIndex = 5;
//
// btnDialog
//
this.btnDialog.Dock = System.Windows.Forms.DockStyle.Top;
this.btnDialog.Location = new System.Drawing.Point(0, 0);
this.btnDialog.Location = new System.Drawing.Point(0, 26);
this.btnDialog.Name = "btnDialog";
this.btnDialog.Padding = new System.Windows.Forms.Padding(5);
this.btnDialog.Size = new System.Drawing.Size(200, 30);
this.btnDialog.TabIndex = 4;
this.btnDialog.Text = "Dialog";
//
// darkTitle1
//
this.darkTitle1.Dock = System.Windows.Forms.DockStyle.Top;
this.darkTitle1.Location = new System.Drawing.Point(0, 0);
this.darkTitle1.Name = "darkTitle1";
this.darkTitle1.Size = new System.Drawing.Size(200, 26);
this.darkTitle1.TabIndex = 14;
this.darkTitle1.Text = "Dialogs";
//
// DialogControls
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@ -321,5 +362,8 @@ namespace Example
private DarkRadioButton darkRadioButton2;
private DarkRadioButton darkRadioButton1;
private DarkRadioButton darkRadioButton3;
private DarkTitle darkTitle1;
private DarkTitle darkTitle2;
private DarkTitle darkTitle3;
}
}