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,155 @@
#if FRAMEWORK20
using System;
using System.Text;
using System.ComponentModel.Design;
using System.ComponentModel;
using System.Drawing;
namespace DevComponents.AdvTree.Design
{
internal class AdvTreeActionList : DesignerActionList
{
private AdvTreeDesigner _Designer = null;
/// <summary>
/// Initializes a new instance of the AdvTreeActionList class.
/// </summary>
/// <param name="designer"></param>
public AdvTreeActionList(AdvTreeDesigner designer):base(designer.Component)
{
_Designer = designer;
}
public override DesignerActionItemCollection GetSortedActionItems()
{
DesignerActionItemCollection items = new DesignerActionItemCollection();
items.Add(new DesignerActionHeaderItem("Nodes"));
items.Add(new DesignerActionHeaderItem("Columns"));
items.Add(new DesignerActionHeaderItem("Selection"));
items.Add(new DesignerActionMethodItem(this, "CreateNode", "Create Node", "Nodes", true));
items.Add(new DesignerActionPropertyItem("CellEdit", "Allow node text editing?", "Nodes", "Indicates whether node cells are editable"));
items.Add(new DesignerActionMethodItem(this, "EditColumns", "Edit Columns...", "Columns", "Edit Tree Control Columns", true));
items.Add(new DesignerActionPropertyItem("ColumnsVisible", "Column header visible?", "Columns", "Indicates whether tree column header is visible"));
items.Add(new DesignerActionPropertyItem("GridColumnLines", "Show grid column lines?", "Columns", "Indicates whether grid lines are visible"));
items.Add(new DesignerActionPropertyItem("GridRowLines", "Show grid row lines?", "Nodes", "Indicates whether grid lines between nodes are visible"));
items.Add(new DesignerActionPropertyItem("GridLinesColor", "Grid lines color:", "Columns", "Indicates custom color for grid lines"));
items.Add(new DesignerActionPropertyItem("SelectionBox", "Show selection?", "Selection", "Indicates whether selection is shown for selected node"));
items.Add(new DesignerActionPropertyItem("SelectionBoxStyle", "Selection style:", "Selection", "Indicates selection style"));
items.Add(new DesignerActionPropertyItem("HotTracking", "Highlight mouse over node?", "Selection", "Indicates whether node that mouse is over is highlighted"));
return items;
}
public void CreateNode()
{
_Designer.CreateNode();
}
public void EditColumns()
{
_Designer.EditColumns();
}
public bool HotTracking
{
get
{
return ((AdvTree)base.Component).HotTracking;
}
set
{
TypeDescriptor.GetProperties(base.Component)["HotTracking"].SetValue(base.Component, value);
}
}
public bool SelectionBox
{
get
{
return ((AdvTree)base.Component).SelectionBox;
}
set
{
TypeDescriptor.GetProperties(base.Component)["SelectionBox"].SetValue(base.Component, value);
}
}
public eSelectionStyle SelectionBoxStyle
{
get
{
return ((AdvTree)base.Component).SelectionBoxStyle;
}
set
{
TypeDescriptor.GetProperties(base.Component)["SelectionBoxStyle"].SetValue(base.Component, value);
}
}
public bool ColumnsVisible
{
get
{
return ((AdvTree)base.Component).ColumnsVisible;
}
set
{
TypeDescriptor.GetProperties(base.Component)["ColumnsVisible"].SetValue(base.Component, value);
}
}
public bool GridColumnLines
{
get
{
return ((AdvTree)base.Component).GridColumnLines;
}
set
{
TypeDescriptor.GetProperties(base.Component)["GridColumnLines"].SetValue(base.Component, value);
}
}
public bool GridRowLines
{
get
{
return ((AdvTree)base.Component).GridRowLines;
}
set
{
TypeDescriptor.GetProperties(base.Component)["GridRowLines"].SetValue(base.Component, value);
}
}
public Color GridLinesColor
{
get
{
return ((AdvTree)base.Component).GridLinesColor;
}
set
{
TypeDescriptor.GetProperties(base.Component)["GridLinesColor"].SetValue(base.Component, value);
}
}
public bool CellEdit
{
get
{
return ((AdvTree)base.Component).CellEdit;
}
set
{
TypeDescriptor.GetProperties(base.Component)["CellEdit"].SetValue(base.Component, value);
}
}
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Support for Cell tabs design-time editor.
/// </summary>
public class CellCollectionEditor : System.ComponentModel.Design.CollectionEditor
{
/// <summary>Creates new instance of cell collection editor.</summary>
/// <param name="type">Type to initialize editor with.</param>
public CellCollectionEditor(Type type)
: base(type)
{
}
protected override Type CreateCollectionItemType()
{
return typeof(Cell);
}
protected override Type[] CreateNewItemTypes()
{
return new Type[] { typeof(Cell) };
}
protected override object CreateInstance(Type itemType)
{
object item = base.CreateInstance(itemType);
if (item is Cell)
{
Cell cell = item as Cell;
cell.Text = cell.Name;
}
return item;
}
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Text;
using System.ComponentModel.Design;
using DevComponents.AdvTree;
using System.Collections;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Defines designer for ColumnHeader class.
/// </summary>
public class ColumnHeaderDesigner : ComponentDesigner
{
#region Internal Implementation
#if FRAMEWORK20
public override void InitializeNewComponent(IDictionary defaultValues)
{
SetDefaults();
base.InitializeNewComponent(defaultValues);
}
#else
/// <summary>Sets design-time defaults for component.</summary>
public override void OnSetComponentDefaults()
{
base.OnSetComponentDefaults();
SetDefaults();
}
#endif
private void SetDefaults()
{
ColumnHeader ch = this.Component as ColumnHeader;
ch.Width.Absolute = 150;
ch.Text = "Column";
}
#endregion
}
}

View File

@@ -0,0 +1,271 @@
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Summary description for ComponentNotLicensed.
/// </summary>
public class ComponentNotLicensed : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.LinkLabel linkOrder;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.LinkLabel linkHome;
private System.Windows.Forms.LinkLabel linkEmail;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Timer timer1;
private System.ComponentModel.IContainer components;
public ComponentNotLicensed()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(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.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.linkOrder = new System.Windows.Forms.LinkLabel();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.linkHome = new System.Windows.Forms.LinkLabel();
this.linkEmail = new System.Windows.Forms.LinkLabel();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.linkOrder);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Location = new System.Drawing.Point(11, 54);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(294, 135);
this.groupBox1.TabIndex = 17;
this.groupBox1.TabStop = false;
//
// label7
//
this.label7.Location = new System.Drawing.Point(3, 104);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(285, 12);
this.label7.TabIndex = 3;
this.label7.Text = "Order at:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// linkOrder
//
this.linkOrder.Location = new System.Drawing.Point(6, 116);
this.linkOrder.Name = "linkOrder";
this.linkOrder.Size = new System.Drawing.Size(280, 15);
this.linkOrder.TabIndex = 2;
this.linkOrder.TabStop = true;
this.linkOrder.Text = "http://www.devcomponents.com/AdvTree/order.html";
this.linkOrder.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.linkOrder.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkOrder_LinkClicked);
//
// label6
//
this.label6.Location = new System.Drawing.Point(9, 72);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(276, 31);
this.label6.TabIndex = 1;
this.label6.Text = "For pricing and licensing information please visit our web site. ";
//
// label5
//
this.label5.ForeColor = System.Drawing.Color.Maroon;
this.label5.Location = new System.Drawing.Point(8, 20);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(276, 52);
this.label5.TabIndex = 0;
this.label5.Text = "This component is not registered and it is provided for evaluation purposes only." +
" This message will not appear after you register the component.";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(10, 216);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(31, 16);
this.label4.TabIndex = 16;
this.label4.Text = "Web:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(9, 200);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(40, 16);
this.label3.TabIndex = 14;
this.label3.Text = "E-Mail:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(7, 31);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(307, 16);
this.label2.TabIndex = 11;
this.label2.Text = "(c) 2005-2006 by DevComponents.com, All Rights Reserved";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.Location = new System.Drawing.Point(9, 7);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(236, 18);
this.label1.TabIndex = 9;
this.label1.Text = "DevComponents AdvTree Component";
//
// linkHome
//
this.linkHome.Location = new System.Drawing.Point(50, 215);
this.linkHome.Name = "linkHome";
this.linkHome.Size = new System.Drawing.Size(145, 16);
this.linkHome.TabIndex = 15;
this.linkHome.TabStop = true;
this.linkHome.Text = "www.devcomponents.com";
this.linkHome.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkHome_LinkClicked);
//
// linkEmail
//
this.linkEmail.Location = new System.Drawing.Point(49, 199);
this.linkEmail.Name = "linkEmail";
this.linkEmail.Size = new System.Drawing.Size(167, 16);
this.linkEmail.TabIndex = 13;
this.linkEmail.TabStop = true;
this.linkEmail.Text = "support@devcomponents.com";
this.linkEmail.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkEmail_LinkClicked);
//
// button2
//
this.button2.Location = new System.Drawing.Point(232, 240);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(72, 24);
this.button2.TabIndex = 12;
this.button2.Text = "Buy Now";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Enabled = false;
this.button1.Location = new System.Drawing.Point(152, 240);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 24);
this.button1.TabIndex = 10;
this.button1.Text = "OK";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 800;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// ComponentNotLicensed
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.BlanchedAlmond;
this.ClientSize = new System.Drawing.Size(314, 273);
this.ControlBox = false;
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.linkHome);
this.Controls.Add(this.linkEmail);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "ComponentNotLicensed";
this.Text = "AdvTree License not found";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void button2_Click(object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start(linkOrder.Text);
}
private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void linkHome_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://www.devcomponents.com");
}
private void linkOrder_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(linkOrder.Text);
}
private void linkEmail_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(linkEmail.Text);
}
private void timer1_Tick(object sender, System.EventArgs e)
{
timer1.Enabled=false;
button1.Enabled=true;
button1.Focus();
}
}
}

View File

@@ -0,0 +1,265 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
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">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</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 forserialized 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.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:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="groupBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="groupBox1.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
<data name="groupBox1.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="groupBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="groupBox1.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="groupBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label7.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="label7.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label7.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="linkOrder.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="linkOrder.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="linkOrder.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="label6.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="label6.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label6.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label5.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="label5.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label5.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label4.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="label4.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label4.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label3.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="label3.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="label2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="label1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="linkHome.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="linkHome.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="linkHome.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="linkEmail.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="linkEmail.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="linkEmail.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="button2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="button2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="button2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="button1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="button1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="button1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="timer1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="timer1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</data>
<data name="timer1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>(Default)</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
<data name="$this.Name">
<value>ComponentNotLicensed</value>
</data>
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>80</value>
</data>
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
</root>

View File

@@ -0,0 +1,151 @@
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms.Design;
using System.Windows.Forms;
using System.ComponentModel.Design;
using DevComponents.DotNetBar;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Represents type editor for ElementStyle used for Windows Forms design-time support.
/// </summary>
public class ElementStyleTypeEditor:System.Drawing.Design.UITypeEditor
{
#region Private Variables
private IWindowsFormsEditorService m_EditorService = null;
private const string OPTION_CREATE="Create style";
private const string OPTION_REMOVE="Delete selected style";
private const string OPTION_STYLES="Styles.";
#endregion
#region Internal Implementation
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context != null
&& context.Instance != null
&& provider != null)
{
ElementStyle es=value as ElementStyle;
m_EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
if(m_EditorService!=null)
{
AdvTree tree = null;
if(context.Instance is AdvTree)
tree=context.Instance as AdvTree;
else if(context.Instance is Node)
tree=((Node)context.Instance).TreeControl;
else if(context.Instance is Cell)
tree=((Cell)context.Instance).TreeControl;
ListBox lb=new ListBox();
if(es==null)
lb.Items.Add(OPTION_CREATE);
else
lb.Items.Add(OPTION_REMOVE);
if(tree!=null)
{
foreach(ElementStyle style in tree.Styles)
lb.Items.Add(style);
}
string[] styles = Enum.GetNames(typeof (ePredefinedElementStyle));
foreach(string s in styles)
lb.Items.Add(OPTION_STYLES + s);
lb.SelectedIndexChanged+=new EventHandler(this.SelectedChanged);
m_EditorService.DropDownControl(lb);
IDesignerHost dh=(IDesignerHost)provider.GetService(typeof(IDesignerHost));
if(lb.SelectedItem!=null && dh!=null)
{
if(lb.SelectedItem is ElementStyle)
{
value=lb.SelectedItem as ElementStyle;
}
else if(lb.SelectedItem!=null && lb.SelectedItem.ToString().StartsWith(OPTION_STYLES))
{
string styleName = lb.SelectedItem.ToString().Substring(OPTION_STYLES.Length);
Type t = typeof (NodeStyles);
ElementStyle predefinedStyle=t.GetProperty(styleName).GetValue(null, null) as ElementStyle;
ElementStyle newStyle=dh.CreateComponent(typeof(ElementStyle)) as ElementStyle;
newStyle.ApplyStyle(predefinedStyle);
newStyle.Description = styleName;
value = newStyle;
if(tree!=null)
{
IComponentChangeService cc = provider.GetService(typeof (IComponentChangeService)) as IComponentChangeService;
if(cc!=null)
cc.OnComponentChanging(tree, TypeDescriptor.GetProperties(tree)["Style"]);
tree.Styles.Add(value as ElementStyle);
if(cc!=null)
cc.OnComponentChanged(tree, TypeDescriptor.GetProperties(tree)["Style"],null,null);
}
}
else if(lb.SelectedItem!=null && lb.SelectedItem.ToString()==OPTION_CREATE)
{
value=dh.CreateComponent(typeof(ElementStyle)) as ElementStyle;
if(tree!=null)
{
IComponentChangeService cc = provider.GetService(typeof (IComponentChangeService)) as IComponentChangeService;
if(cc!=null)
cc.OnComponentChanging(tree, TypeDescriptor.GetProperties(tree)["Style"]);
tree.Styles.Add(value as ElementStyle);
if(cc!=null)
cc.OnComponentChanged(tree, TypeDescriptor.GetProperties(tree)["Style"],null,null);
}
}
else if(lb.SelectedItem!=null && lb.SelectedItem.ToString()==OPTION_REMOVE)
{
if(tree!=null)
{
IComponentChangeService cc = provider.GetService(typeof (IComponentChangeService)) as IComponentChangeService;
if(cc!=null)
cc.OnComponentChanging(tree, TypeDescriptor.GetProperties(tree)["Style"]);
if(tree!=null)
tree.Styles.Remove(value as ElementStyle);
if(cc!=null)
cc.OnComponentChanged(tree, TypeDescriptor.GetProperties(tree)["Style"],null,null);
if(tree.Styles.Count>0)
value = tree.Styles[0];
else
value=null;
}
else
value=null;
dh.DestroyComponent(es);
}
}
}
}
return value;
}
private void SelectedChanged(object sender, EventArgs e)
{
if(m_EditorService!=null)
m_EditorService.CloseDropDown();
}
/// <summary>
/// Gets the editor style used by the EditValue method.
/// </summary>
/// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
/// <returns>A UITypeEditorEditStyle value that indicates the style of editor used by EditValue. If the UITypeEditor does not support this method, then GetEditStyle will return None</returns>
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
if (context != null && context.Instance != null)
{
return UITypeEditorEditStyle.DropDown;
}
return base.GetEditStyle(context);
}
#endregion
}
}

View File

@@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms.Design;
using DevComponents.DotNetBar;
using System.Windows.Forms;
using System.Collections;
using System.ComponentModel.Design;
using System.ComponentModel;
using System.Drawing.Design;
namespace DevComponents.AdvTree.Design
{
public class HostedItemTypeEditor : System.Drawing.Design.UITypeEditor
{
#region Private Variables
private IWindowsFormsEditorService m_EditorService = null;
private const string OPTION_REMOVE = "Delete Item";
private Dictionary<string, Type> _Items = new Dictionary<string, Type>();
#endregion
#region Internal Implementation
/// <summary>
/// Initializes a new instance of the HostedItemTypeEditor class.
/// </summary>
public HostedItemTypeEditor() : base()
{
_Items.Add("Button", typeof(ButtonItem));
_Items.Add("Check-box", typeof(CheckBoxItem));
_Items.Add("Micro-Chart", typeof(MicroChartItem));
_Items.Add("Switch", typeof(SwitchButtonItem));
_Items.Add("Slider", typeof(SliderItem));
_Items.Add("Rating", typeof(RatingItem));
_Items.Add("Progress bar", typeof(ProgressBarItem));
_Items.Add("Container", typeof(ItemContainer));
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context != null
&& context.Instance != null
&& provider != null)
{
m_EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
if (m_EditorService != null)
{
Cell currentCell = null;
if (context.Instance is Node)
currentCell = ((Node)context.Instance).Cells[0];
else if (context.Instance is Cell)
currentCell = (Cell)context.Instance;
if (currentCell == null)
{
MessageBox.Show(string.Format("Invalid context.Instance. Instance: {0}", context.Instance));
return value;
}
ListBox lb = new ListBox();
if (currentCell.HostedItem != null)
{
lb.Items.Add(OPTION_REMOVE);
lb.Items.Add("------------------");
}
foreach (KeyValuePair<string, Type> item in _Items)
{
lb.Items.Add(item.Key);
}
lb.SelectedIndexChanged += new EventHandler(this.SelectedChanged);
m_EditorService.DropDownControl(lb);
IDesignerHost dh = (IDesignerHost)provider.GetService(typeof(IDesignerHost));
if (lb.SelectedItem != null && dh != null)
{
if (lb.SelectedItem == OPTION_REMOVE)
{
BaseItem item = currentCell.HostedItem;
dh.DestroyComponent(item);
value = null;
}
else if (_Items.ContainsKey(lb.SelectedItem.ToString()))
{
if (currentCell.HostedItem != null)
{
BaseItem item = currentCell.HostedItem;
dh.DestroyComponent(item);
}
BaseItem newItem = dh.CreateComponent(_Items[(string)lb.SelectedItem]) as BaseItem;
if (!string.IsNullOrEmpty(newItem.Name) && string.IsNullOrEmpty(newItem.Text))
TypeDescriptor.GetProperties(newItem)["Text"].SetValue(newItem, newItem.Name);
value = newItem;
}
}
}
}
return value;
}
private void SelectedChanged(object sender, EventArgs e)
{
if (m_EditorService != null)
m_EditorService.CloseDropDown();
}
/// <summary>
/// Gets the editor style used by the EditValue method.
/// </summary>
/// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
/// <returns>A UITypeEditorEditStyle value that indicates the style of editor used by EditValue. If the UITypeEditor does not support this method, then GetEditStyle will return None</returns>
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
if (context != null && context.Instance != null)
{
return UITypeEditorEditStyle.DropDown;
}
return base.GetEditStyle(context);
}
#endregion
}
}

View File

@@ -0,0 +1,75 @@
using System;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.ComponentModel;
using System.Windows.Forms.ComponentModel;
using System.Windows.Forms.Design;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Represents the class used by windows forms editor for picking an image from image list.
/// </summary>
public class ImageIndexEditor:UITypeEditor
{
private ImageEditor m_ImageEditor;
private System.Windows.Forms.ImageList m_ImageList=null;
public ImageIndexEditor():base()
{
m_ImageEditor=System.ComponentModel.TypeDescriptor.GetEditor(typeof(System.Drawing.Image),typeof(UITypeEditor)) as ImageEditor;
}
public override bool GetPaintValueSupported(ITypeDescriptorContext context)
{
return true;
}
public override void PaintValue(PaintValueEventArgs e)
{
try
{
if(e==null || e.Value==null)
return;
int iIndex=(int)e.Value;
System.Drawing.Image img=this.GetImage(e.Context,iIndex);
if(img==null)
return;
PaintValueEventArgs pi=new PaintValueEventArgs(e.Context,img,e.Graphics,e.Bounds);
m_ImageEditor.PaintValue(pi);
//m_ImageEditor.PaintValue(img,e.Graphics,e.Bounds);
}
catch{}
}
private System.Drawing.Image GetImage(System.ComponentModel.ITypeDescriptorContext context,int index)
{
if(m_ImageList!=null && index>=0 && index<=m_ImageList.Images.Count)
{
return m_ImageList.Images[index];
}
if(context==null)
return null;
object o=context.Instance;
if(o==null)
return null;
System.ComponentModel.PropertyDescriptorCollection pd=System.ComponentModel.TypeDescriptor.GetProperties(o);
if(pd==null)
return null;
foreach(System.ComponentModel.PropertyDescriptor prop in pd)
{
if(prop.PropertyType==typeof(System.Windows.Forms.ImageList))
{
m_ImageList=prop.GetValue(o) as System.Windows.Forms.ImageList;
if(m_ImageList!=null && index>=0 && index<=m_ImageList.Images.Count)
{
return m_ImageList.Images[index];
}
break;
}
}
return null;
}
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DevComponents.AdvTree.Design
{
#region NodeCollectionEditor
/// <summary>
/// Support for Node tabs design-time editor.
/// </summary>
public class NodeCollectionEditor : System.ComponentModel.Design.CollectionEditor
{
public NodeCollectionEditor(Type type)
: base(type)
{
}
protected override Type CreateCollectionItemType()
{
return typeof(Node);
}
protected override Type[] CreateNewItemTypes()
{
return new Type[] { typeof(Node) };
}
protected override object CreateInstance(Type itemType)
{
object item = base.CreateInstance(itemType);
if (item is Node)
{
Node node = item as Node;
node.Text = node.Name;
}
return item;
}
}
#endregion
}

View File

@@ -0,0 +1,86 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms.Design;
using System.Windows.Forms;
using System.ComponentModel.Design;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Represents type editor for NodeConnector used for Windows Forms design-time support.
/// </summary>
public class NodeConnectorTypeEditor:System.Drawing.Design.UITypeEditor
{
#region Private Variables
private IWindowsFormsEditorService m_EditorService = null;
private const string OPTION_CREATE="Create new connector";
private const string OPTION_REMOVE="Remove connector";
#endregion
#region Internal Implementation
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context != null
&& context.Instance != null
&& provider != null)
{
NodeConnector conn=value as NodeConnector;
m_EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
if(m_EditorService!=null)
{
ListBox lb=new ListBox();
lb.SelectedIndexChanged+=new EventHandler(this.SelectedChanged);
if(conn==null)
lb.Items.Add(OPTION_CREATE);
else
lb.Items.Add(OPTION_REMOVE);
m_EditorService.DropDownControl(lb);
IDesignerHost dh=(IDesignerHost)provider.GetService(typeof(IDesignerHost));
if(lb.SelectedItem!=null && dh!=null)
{
if(lb.SelectedItem.ToString()==OPTION_CREATE)
{
NodeConnector nd=dh.CreateComponent(typeof(NodeConnector)) as NodeConnector;
nd.LineWidth = 1;
value = nd;
}
else if(lb.SelectedItem.ToString()==OPTION_REMOVE)
{
value=null;
dh.DestroyComponent(conn);
}
}
}
}
return value;
}
private void SelectedChanged(object sender, EventArgs e)
{
if(m_EditorService!=null)
m_EditorService.CloseDropDown();
}
/// <summary>
/// Gets the editor style used by the EditValue method.
/// </summary>
/// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
/// <returns>A UITypeEditorEditStyle value that indicates the style of editor used by EditValue. If the UITypeEditor does not support this method, then GetEditStyle will return None</returns>
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
if (context != null && context.Instance != null)
{
return UITypeEditorEditStyle.DropDown;
}
return base.GetEditStyle(context);
}
#endregion
}
}

View File

@@ -0,0 +1,97 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms.Design;
using System.Windows.Forms;
using System.ComponentModel.Design;
using System.Collections;
using DevComponents.DotNetBar;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Represents context menu type editor for Node.ContextMenu property.
/// </summary>
public class NodeContextMenuTypeEditor:System.Drawing.Design.UITypeEditor
{
#region Private Variables
private IWindowsFormsEditorService m_EditorService = null;
public static string DotNetBarPrefix="DotNetBar.";
#endregion
#region Internal Implementation
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (context != null
&& context.Instance != null
&& provider != null)
{
m_EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
if(m_EditorService!=null)
{
ListBox lb=new ListBox();
DevComponents.DotNetBar.ContextMenuBar contextMenuBar = null;
lb.SelectedIndexChanged+=new EventHandler(this.SelectedChanged);
IDesignerHost host = (IDesignerHost)provider.GetService(typeof(IDesignerHost));
foreach(IComponent component in host.Container.Components)
{
if(component is ContextMenu || component.GetType().FullName=="System.Windows.Forms.ContextMenuStrip")
{
lb.Items.Add(component);
}
if (component is DevComponents.DotNetBar.ContextMenuBar)
{
contextMenuBar = component as DevComponents.DotNetBar.ContextMenuBar;
foreach (BaseItem item in contextMenuBar.Items)
{
lb.Items.Add(DotNetBarPrefix + item.Name);
}
}
}
m_EditorService.DropDownControl(lb);
if(lb.SelectedItem!=null)
{
if(lb.SelectedItem.ToString().StartsWith(DotNetBarPrefix))
{
Node node=context.Instance as Node;
if (node != null && node.TreeControl != null)
{
TypeDescriptor.GetProperties(node.TreeControl)["ContextMenuBar"].SetValue(node.TreeControl, contextMenuBar);
}
return contextMenuBar.Items[lb.SelectedItem.ToString().Substring(DotNetBarPrefix.Length)];
}
return lb.SelectedItem;
}
}
}
return value;
}
private void SelectedChanged(object sender, EventArgs e)
{
if(m_EditorService!=null)
m_EditorService.CloseDropDown();
}
/// <summary>
/// Gets the editor style used by the EditValue method.
/// </summary>
/// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
/// <returns>A UITypeEditorEditStyle value that indicates the style of editor used by EditValue. If the UITypeEditor does not support this method, then GetEditStyle will return None</returns>
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
if (context != null && context.Instance != null)
{
return UITypeEditorEditStyle.DropDown;
}
return base.GetEditStyle(context);
}
#endregion
}
}

View File

@@ -0,0 +1,207 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace DevComponents.AdvTree.Design
{
/// <summary>
/// Represents Windows Forms designer for Node object.
/// </summary>
public class NodeDesigner:ComponentDesigner
{
/// <summary>
/// Initializes designer with given component.
/// </summary>
/// <param name="component">Component to initialize designer with.</param>
public override void Initialize(IComponent component)
{
base.Initialize(component);
if(!component.Site.DesignMode)
return;
ISelectionService ss =(ISelectionService)GetService(typeof(ISelectionService));
if(ss!=null)
ss.SelectionChanged+=new EventHandler(OnSelectionChanged);
Node n=component as Node;
if(n!=null)
this.Visible=n.Visible;
}
private void OnSelectionChanged(object sender, EventArgs e)
{
ISelectionService ss = (ISelectionService)sender;
if (this.Component != null && ss.PrimarySelection != this.Component)
{
Node node = this.Component as Node;
if (ss.PrimarySelection is Node)
{
Node selected = ss.PrimarySelection as Node;
if (selected.TreeControl != node.TreeControl)
{
node.TreeControl.SelectedNode = null;
}
}
else if (node != null && node.TreeControl != null)
node.TreeControl.SelectedNode = null;
}
}
protected override void PreFilterProperties(System.Collections.IDictionary properties)
{
base.PreFilterProperties(properties);
properties["Visible"] = TypeDescriptor.CreateProperty(typeof(NodeDesigner),(PropertyDescriptor)properties["Visible"], new Attribute[]
{
new DefaultValueAttribute(true),
new BrowsableAttribute(true),
new CategoryAttribute("Layout")});
// properties["HostedControl"] = TypeDescriptor.CreateProperty(typeof(NodeDesigner),(PropertyDescriptor)properties["HostedControl"], new Attribute[]
// {
// new DefaultValueAttribute(null),
// new BrowsableAttribute(true),
// new CategoryAttribute("Behavior"),
// new DescriptionAttribute("Indicates control hosted inside of the cell.")});
}
/// <summary>
/// Gets or sets whether item is visible.
/// </summary>
[DefaultValue(true),Browsable(true),Category("Layout"),Description("Gets or sets whether node is visible.")]
public bool Visible
{
get
{
return (bool)ShadowProperties["Visible"];
}
set
{
// this value is not passed to the actual control
this.ShadowProperties["Visible"] = value;
}
}
// /// <summary>
// /// Gets or sets whether item is visible.
// /// </summary>
// [DefaultValue(null),Browsable(true),Category("Behavior"),Description("Indicates control hosted inside of the cell.")]
// public Control HostedControl
// {
// get
// {
// Node node = this.Component as Node;
// return node.HostedControl;
// }
// set
// {
// Node node = this.Component as Node;
// node.HostedControl = value;
// if(value!=null)
// {
// IDesignerHost dh = this.GetService(typeof (IDesignerHost)) as IDesignerHost;
// if(dh!=null)
// {
// AdvTreeDesigner ds = dh.GetDesigner(node.TreeControl) as AdvTreeDesigner;
// if(ds!=null)
// ds.HookControl(value);
// }
// }
// }
// }
/// <summary>Returns design-time commands applicable to this designer.</summary>
public override DesignerVerbCollection Verbs
{
get
{
DesignerVerb[] verbs = new DesignerVerb[]
{
new DesignerVerb("Create Child Node", new EventHandler(CreateNode)),
new DesignerVerb("Edit Cells...", new EventHandler(EditCells)),
new DesignerVerb("Edit Columns...", new EventHandler(EditColumns))
};
return new DesignerVerbCollection(verbs);
}
}
private void EditCells(object sender, EventArgs e)
{
AdvTreeDesigner.EditValue(this, this.Component, "Cells");
}
private void EditColumns(object sender, EventArgs e)
{
AdvTreeDesigner.EditValue(this, this.Component, "NodesColumns");
}
private void CreateNode(object sender, EventArgs e)
{
Node node=CreateNode(this.Component as Node);
if(node!=null)
{
ISelectionService sel = this.GetService(typeof (ISelectionService)) as ISelectionService;
ArrayList list=new ArrayList(1);
list.Add(node);
if(sel!=null)
{
sel.SetSelectedComponents(list, SelectionTypes.MouseDown);
node.TreeControl.SelectedNode = node;
}
}
}
private Node CreateNode(Node parentNode)
{
IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost));
if(dh==null)
return null;
Node node=null;
AdvTree tree=((Node)this.Component).TreeControl;
tree.BeginUpdate();
try
{
IComponentChangeService change=this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
if(change!=null)
{
if(parentNode!=null)
change.OnComponentChanging(this.Component,TypeDescriptor.GetProperties(parentNode).Find("Nodes",true));
else
change.OnComponentChanging(this.Component,TypeDescriptor.GetProperties(tree).Find("Nodes",true));
}
node=dh.CreateComponent(typeof(Node)) as Node;
if(node!=null)
{
node.Text=node.Name;
node.Expanded = true;
if(parentNode==null)
tree.Nodes.Add(node);
else
{
parentNode.Nodes.Add(node);
parentNode.Expand();
TypeDescriptor.GetProperties(node)["Style"].SetValue(node,parentNode.Style);
}
if(change!=null)
{
if(parentNode!=null)
change.OnComponentChanged(this.Component,TypeDescriptor.GetProperties(parentNode).Find("Nodes",true),null,null);
else
change.OnComponentChanged(this.Component,TypeDescriptor.GetProperties(tree).Find("Nodes",true),null,null);
}
}
}
finally
{
tree.EndUpdate();
}
return node;
}
}
}