Created DarkTreeView

This commit is contained in:
Robin 2015-09-18 13:01:09 +01:00
parent 217058af72
commit bd776d5013
17 changed files with 2095 additions and 16 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,254 @@
using System;
using System.Drawing;
namespace DarkUI
{
public class DarkTreeNode
{
#region Event Region
public event EventHandler<ObservableListModified<DarkTreeNode>> ItemsAdded;
public event EventHandler<ObservableListModified<DarkTreeNode>> ItemsRemoved;
public event EventHandler TextChanged;
public event EventHandler NodeExpanded;
public event EventHandler NodeCollapsed;
#endregion
#region Field Region
private string _text;
private bool _isRoot;
private DarkTreeView _parentTree;
private DarkTreeNode _parentNode;
private ObservableList<DarkTreeNode> _nodes;
private bool _expanded;
#endregion
#region Property Region
public string Text
{
get { return _text; }
set
{
if (_text == value)
return;
_text = value;
OnTextChanged();
}
}
public Rectangle ExpandArea { get; set; }
public Rectangle IconArea { get; set; }
public Rectangle TextArea { get; set; }
public Rectangle FullArea { get; set; }
public bool ExpandAreaHot { get; set; }
public Bitmap Icon { get; set; }
public Bitmap ExpandedIcon { get; set; }
public bool Expanded
{
get { return _expanded; }
set
{
if (_expanded == value)
return;
if (value == true && Nodes.Count == 0)
return;
_expanded = value;
if (_expanded)
{
if (NodeExpanded != null)
NodeExpanded(this, null);
}
else
{
if (NodeCollapsed != null)
NodeCollapsed(this, null);
}
}
}
public ObservableList<DarkTreeNode> Nodes
{
get { return _nodes; }
set
{
if (_nodes != null)
{
_nodes.ItemsAdded -= Nodes_ItemsAdded;
_nodes.ItemsRemoved -= Nodes_ItemsRemoved;
}
_nodes = value;
_nodes.ItemsAdded += Nodes_ItemsAdded;
_nodes.ItemsRemoved += Nodes_ItemsRemoved;
}
}
public bool IsRoot
{
get { return _isRoot; }
set { _isRoot = value; }
}
public DarkTreeView ParentTree
{
get { return _parentTree; }
set
{
if (_parentTree == value)
return;
_parentTree = value;
foreach (var node in Nodes)
node.ParentTree = _parentTree;
}
}
public DarkTreeNode ParentNode
{
get { return _parentNode; }
set { _parentNode = value; }
}
public bool Odd { get; set; }
public object NodeType { get; set; }
public object Tag { get; set; }
public string FullPath
{
get
{
var parent = ParentNode;
var path = Text;
while (parent != null)
{
path = string.Format("{0}{1}{2}", parent.Text, "\\", path);
parent = parent.ParentNode;
}
return path;
}
}
public DarkTreeNode PrevVisibleNode { get; set; }
public DarkTreeNode NextVisibleNode { get; set; }
public int VisibleIndex { get; set; }
public bool IsNodeAncestor(DarkTreeNode node)
{
var parent = ParentNode;
while (parent != null)
{
if (parent == node)
return true;
parent = parent.ParentNode;
}
return false;
}
#endregion
#region Constructor Region
public DarkTreeNode()
{
Nodes = new ObservableList<DarkTreeNode>();
}
public DarkTreeNode(string text)
: this()
{
Text = text;
}
#endregion
#region Method Region
public void Remove()
{
if (ParentNode != null)
ParentNode.Nodes.Remove(this);
else
ParentTree.Nodes.Remove(this);
}
public void EnsureVisible()
{
var parent = ParentNode;
while (parent != null)
{
parent.Expanded = true;
parent = parent.ParentNode;
}
}
#endregion
#region Event Handler Region
private void OnTextChanged()
{
if (ParentTree != null && ParentTree.TreeViewNodeSorter != null)
{
if (ParentNode != null)
ParentNode.Nodes.Sort(ParentTree.TreeViewNodeSorter);
else
ParentTree.Nodes.Sort(ParentTree.TreeViewNodeSorter);
}
if (TextChanged != null)
TextChanged(this, null);
}
private void Nodes_ItemsAdded(object sender, ObservableListModified<DarkTreeNode> e)
{
foreach (var node in e.Items)
{
node.ParentNode = this;
node.ParentTree = ParentTree;
}
if (ParentTree != null && ParentTree.TreeViewNodeSorter != null)
Nodes.Sort(ParentTree.TreeViewNodeSorter);
if (ItemsAdded != null)
ItemsAdded(this, e);
}
private void Nodes_ItemsRemoved(object sender, ObservableListModified<DarkTreeNode> e)
{
if (Nodes.Count == 0)
Expanded = false;
if (ItemsRemoved != null)
ItemsRemoved(this, e);
}
#endregion
}
}

View File

@ -43,7 +43,10 @@
<Compile Include="Config\Colors.cs" /> <Compile Include="Config\Colors.cs" />
<Compile Include="Config\Consts.cs" /> <Compile Include="Config\Consts.cs" />
<Compile Include="Config\Enums.cs" /> <Compile Include="Config\Enums.cs" />
<Compile Include="Controls\Classes\DarkListItem.cs" /> <Compile Include="Controls\DarkTreeView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\Items\DarkListItem.cs" />
<Compile Include="Controls\DarkListView.cs"> <Compile Include="Controls\DarkListView.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
@ -84,6 +87,7 @@
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Controls\EventArgs\ScrollValueEventArgs.cs" /> <Compile Include="Controls\EventArgs\ScrollValueEventArgs.cs" />
<Compile Include="Controls\Items\DarkTreeNode.cs" />
<Compile Include="Extensions\BitmapExtensions.cs" /> <Compile Include="Extensions\BitmapExtensions.cs" />
<Compile Include="Forms\DarkDialog.cs"> <Compile Include="Forms\DarkDialog.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
@ -115,6 +119,11 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<DependentUpon>ScrollIcons.resx</DependentUpon> <DependentUpon>ScrollIcons.resx</DependentUpon>
</Compile> </Compile>
<Compile Include="Icons\TreeViewIcons.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>TreeViewIcons.resx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Renderers\DarkMenuRenderer.cs" /> <Compile Include="Renderers\DarkMenuRenderer.cs" />
<Compile Include="Renderers\DarkToolStripRenderer.cs" /> <Compile Include="Renderers\DarkToolStripRenderer.cs" />
@ -141,6 +150,11 @@
<LastGenOutput>ScrollIcons.Designer.cs</LastGenOutput> <LastGenOutput>ScrollIcons.Designer.cs</LastGenOutput>
<CustomToolNamespace>DarkUI</CustomToolNamespace> <CustomToolNamespace>DarkUI</CustomToolNamespace>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Icons\TreeViewIcons.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TreeViewIcons.Designer.cs</LastGenOutput>
<CustomToolNamespace>DarkUI</CustomToolNamespace>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Resources\grip.png" /> <None Include="Resources\grip.png" />
@ -169,6 +183,18 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\warning.png" /> <None Include="Resources\warning.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Resources\node_closed_empty.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\node_closed_full.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\node_open.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\node_open_empty.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

103
DarkUI/Icons/TreeViewIcons.Designer.cs generated Normal file
View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DarkUI {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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 TreeViewIcons {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal TreeViewIcons() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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.TreeViewIcons", typeof(TreeViewIcons).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap node_closed_empty {
get {
object obj = ResourceManager.GetObject("node_closed_empty", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap node_closed_full {
get {
object obj = ResourceManager.GetObject("node_closed_full", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap node_open {
get {
object obj = ResourceManager.GetObject("node_open", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap node_open_empty {
get {
object obj = ResourceManager.GetObject("node_open_empty", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="node_closed_empty" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\node_closed_empty.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="node_closed_full" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\node_closed_full.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="node_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\node_open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="node_open_empty" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\node_open_empty.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -45,11 +45,20 @@
<Compile Include="Forms\MainForm.Designer.cs"> <Compile Include="Forms\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Icons.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Icons.resx</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Forms\MainForm.resx"> <EmbeddedResource Include="Forms\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Icons.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Icons.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -76,6 +85,15 @@
<Name>DarkUI</Name> <Name>DarkUI</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Resources\folder_16x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\folder_Closed_16xLG.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Files_7954.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -77,8 +77,8 @@
this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel6 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel6 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel();
this.btnDialog = new DarkUI.DarkButton();
this.darkSectionPanel1 = new DarkUI.DarkSectionPanel(); this.darkSectionPanel1 = new DarkUI.DarkSectionPanel();
this.btnDialog = new DarkUI.DarkButton();
this.btnMessageBox = new DarkUI.DarkButton(); this.btnMessageBox = new DarkUI.DarkButton();
this.darkContextMenu1 = new DarkUI.DarkContextMenu(); this.darkContextMenu1 = new DarkUI.DarkContextMenu();
this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -86,12 +86,15 @@
this.test3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.test3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.darkSectionPanel2 = new DarkUI.DarkSectionPanel(); this.darkSectionPanel2 = new DarkUI.DarkSectionPanel();
this.darkListView1 = new DarkUI.DarkListView(); this.darkListView1 = new DarkUI.DarkListView();
this.darkSectionPanel3 = new DarkUI.DarkSectionPanel();
this.darkTreeView1 = new DarkUI.DarkTreeView();
this.mnuMain.SuspendLayout(); this.mnuMain.SuspendLayout();
this.toolMain.SuspendLayout(); this.toolMain.SuspendLayout();
this.darkStatusStrip1.SuspendLayout(); this.darkStatusStrip1.SuspendLayout();
this.darkSectionPanel1.SuspendLayout(); this.darkSectionPanel1.SuspendLayout();
this.darkContextMenu1.SuspendLayout(); this.darkContextMenu1.SuspendLayout();
this.darkSectionPanel2.SuspendLayout(); this.darkSectionPanel2.SuspendLayout();
this.darkSectionPanel3.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// mnuMain // mnuMain
@ -550,24 +553,25 @@
this.toolStripStatusLabel5.Text = "120 MB"; this.toolStripStatusLabel5.Text = "120 MB";
this.toolStripStatusLabel5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 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";
//
// darkSectionPanel1 // darkSectionPanel1
// //
this.darkSectionPanel1.Controls.Add(this.btnDialog);
this.darkSectionPanel1.Controls.Add(this.btnMessageBox); this.darkSectionPanel1.Controls.Add(this.btnMessageBox);
this.darkSectionPanel1.Location = new System.Drawing.Point(431, 157); this.darkSectionPanel1.Location = new System.Drawing.Point(12, 69);
this.darkSectionPanel1.Name = "darkSectionPanel1"; this.darkSectionPanel1.Name = "darkSectionPanel1";
this.darkSectionPanel1.SectionHeader = "Section test"; this.darkSectionPanel1.SectionHeader = "Section test";
this.darkSectionPanel1.Size = new System.Drawing.Size(221, 224); this.darkSectionPanel1.Size = new System.Drawing.Size(221, 224);
this.darkSectionPanel1.TabIndex = 5; this.darkSectionPanel1.TabIndex = 5;
// //
// btnDialog
//
this.btnDialog.Location = new System.Drawing.Point(10, 71);
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 = 6;
this.btnDialog.Text = "Dialog";
//
// btnMessageBox // btnMessageBox
// //
this.btnMessageBox.ContextMenuStrip = this.darkContextMenu1; this.btnMessageBox.ContextMenuStrip = this.darkContextMenu1;
@ -613,7 +617,7 @@
// darkSectionPanel2 // darkSectionPanel2
// //
this.darkSectionPanel2.Controls.Add(this.darkListView1); this.darkSectionPanel2.Controls.Add(this.darkListView1);
this.darkSectionPanel2.Location = new System.Drawing.Point(204, 157); this.darkSectionPanel2.Location = new System.Drawing.Point(239, 69);
this.darkSectionPanel2.Name = "darkSectionPanel2"; this.darkSectionPanel2.Name = "darkSectionPanel2";
this.darkSectionPanel2.SectionHeader = "List view test"; this.darkSectionPanel2.SectionHeader = "List view test";
this.darkSectionPanel2.Size = new System.Drawing.Size(221, 224); this.darkSectionPanel2.Size = new System.Drawing.Size(221, 224);
@ -629,14 +633,34 @@
this.darkListView1.TabIndex = 7; this.darkListView1.TabIndex = 7;
this.darkListView1.Text = "darkListView1"; this.darkListView1.Text = "darkListView1";
// //
// darkSectionPanel3
//
this.darkSectionPanel3.Controls.Add(this.darkTreeView1);
this.darkSectionPanel3.Location = new System.Drawing.Point(466, 69);
this.darkSectionPanel3.Name = "darkSectionPanel3";
this.darkSectionPanel3.SectionHeader = "Tree view test";
this.darkSectionPanel3.Size = new System.Drawing.Size(221, 224);
this.darkSectionPanel3.TabIndex = 8;
//
// darkTreeView1
//
this.darkTreeView1.AllowMoveNodes = true;
this.darkTreeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.darkTreeView1.Location = new System.Drawing.Point(1, 25);
this.darkTreeView1.MultiSelect = true;
this.darkTreeView1.Name = "darkTreeView1";
this.darkTreeView1.Size = new System.Drawing.Size(219, 198);
this.darkTreeView1.TabIndex = 0;
this.darkTreeView1.Text = "darkTreeView1";
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 562); this.ClientSize = new System.Drawing.Size(784, 562);
this.Controls.Add(this.darkSectionPanel3);
this.Controls.Add(this.darkSectionPanel2); this.Controls.Add(this.darkSectionPanel2);
this.Controls.Add(this.darkSectionPanel1); this.Controls.Add(this.darkSectionPanel1);
this.Controls.Add(this.btnDialog);
this.Controls.Add(this.darkStatusStrip1); this.Controls.Add(this.darkStatusStrip1);
this.Controls.Add(this.toolMain); this.Controls.Add(this.toolMain);
this.Controls.Add(this.mnuMain); this.Controls.Add(this.mnuMain);
@ -655,6 +679,7 @@
this.darkSectionPanel1.ResumeLayout(false); this.darkSectionPanel1.ResumeLayout(false);
this.darkContextMenu1.ResumeLayout(false); this.darkContextMenu1.ResumeLayout(false);
this.darkSectionPanel2.ResumeLayout(false); this.darkSectionPanel2.ResumeLayout(false);
this.darkSectionPanel3.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -710,7 +735,6 @@
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel6; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel6;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel5; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel5;
private DarkUI.DarkButton btnDialog;
private DarkUI.DarkSectionPanel darkSectionPanel1; private DarkUI.DarkSectionPanel darkSectionPanel1;
private DarkUI.DarkButton btnMessageBox; private DarkUI.DarkButton btnMessageBox;
private DarkUI.DarkContextMenu darkContextMenu1; private DarkUI.DarkContextMenu darkContextMenu1;
@ -719,6 +743,9 @@
private System.Windows.Forms.ToolStripMenuItem test3ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem test3ToolStripMenuItem;
private DarkUI.DarkSectionPanel darkSectionPanel2; private DarkUI.DarkSectionPanel darkSectionPanel2;
private DarkUI.DarkListView darkListView1; private DarkUI.DarkListView darkListView1;
private DarkUI.DarkButton btnDialog;
private DarkUI.DarkSectionPanel darkSectionPanel3;
private DarkUI.DarkTreeView darkTreeView1;
} }
} }

View File

@ -8,12 +8,33 @@ namespace Example
{ {
InitializeComponent(); InitializeComponent();
// Build dummy list data
for (var i = 0; i < 100; i++) for (var i = 0; i < 100; i++)
{ {
var item = new DarkListItem(string.Format("List item {0}", i)); var item = new DarkListItem(string.Format("List item #{0}", i));
darkListView1.Items.Add(item); darkListView1.Items.Add(item);
} }
// Build dummy nodes
var childCount = 0;
for (var i = 0; i < 20; i++)
{
var node = new DarkTreeNode(string.Format("Root node #{0}", i));
node.ExpandedIcon = Icons.folder_open;
node.Icon = Icons.folder_closed;
for (var x = 0; x < 10; x++)
{
var childNode = new DarkTreeNode(string.Format("Child node #{0}", childCount));
childNode.Icon = Icons.files;
childCount++;
node.Nodes.Add(childNode);
}
darkTreeView1.Nodes.Add(node);
}
// Hook dialog button events
btnDialog.Click += delegate btnDialog.Click += delegate
{ {
DarkMessageBox.ShowError("This is an error", "Dark UI - Example"); DarkMessageBox.ShowError("This is an error", "Dark UI - Example");

93
Example/Icons.Designer.cs generated Normal file
View File

@ -0,0 +1,93 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Example {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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 Icons {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Icons() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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("Example.Icons", typeof(Icons).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap files {
get {
object obj = ResourceManager.GetObject("files", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap folder_closed {
get {
object obj = ResourceManager.GetObject("folder_closed", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap folder_open {
get {
object obj = ResourceManager.GetObject("folder_open", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

130
Example/Icons.resx Normal file
View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="files" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Files_7954.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="folder_closed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\folder_Closed_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="folder_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\folder_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B