DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
|
||||
#if TREEGX
|
||||
namespace DevComponents.Tree.Design
|
||||
#elif DOTNETBAR
|
||||
namespace DevComponents.DotNetBar.Design
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ColorSchemeColorConverter.
|
||||
/// </summary>
|
||||
public class ColorSchemeColorConverter:ColorConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
|
||||
/// </summary>
|
||||
/// <param name="context">An ITypeDescriptorContext that provides a format context. </param>
|
||||
/// <param name="culture">The CultureInfo to use as the current culture. </param>
|
||||
/// <param name="value">The Object to convert. </param>
|
||||
/// <returns>An Object that represents the converted value.</returns>
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
Color color=Color.Empty;
|
||||
if(value is string && value.ToString().StartsWith("CS."))
|
||||
{
|
||||
string propertyName=context.PropertyDescriptor.Name;
|
||||
PropertyInfo property=context.Instance.GetType().GetProperty(propertyName+"SchemePart",BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if(property!=null)
|
||||
{
|
||||
property.SetValue(context.Instance,Enum.Parse(typeof(eColorSchemePart),value.ToString().Substring(4)),new object[]{});
|
||||
color=(Color)context.PropertyDescriptor.GetValue(context.Instance);
|
||||
}
|
||||
}
|
||||
else
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the given value object to the specified type.
|
||||
/// </summary>
|
||||
/// <param name="context">An ITypeDescriptorContext that provides a format context. </param>
|
||||
/// <param name="culture">A CultureInfo object. If a null reference (Nothing in Visual Basic) is passed, the current culture is assumed. </param>
|
||||
/// <param name="value">The Object to convert.</param>
|
||||
/// <param name="destinationType">The Type to convert the value parameter to. </param>
|
||||
/// <returns>An Object that represents the converted value.</returns>
|
||||
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if(context!=null && (destinationType == typeof(string)) && (value is Color))
|
||||
{
|
||||
string propertyName=context.PropertyDescriptor.Name;
|
||||
PropertyInfo property=context.Instance.GetType().GetProperty(propertyName+"SchemePart",BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if(property!=null)
|
||||
{
|
||||
eColorSchemePart part = (eColorSchemePart)property.GetValue(context.Instance, new object[] {});
|
||||
if(part!=eColorSchemePart.None)
|
||||
return "CS." + part.ToString();
|
||||
}
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destinationType);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,271 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.Tree.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/treegx/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 TreeGX 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 = "TreeGX 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();
|
||||
}
|
||||
}
|
||||
}
|
@@ -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>
|
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
using System.Windows.Forms.Design;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel.Design;
|
||||
|
||||
namespace DevComponents.Tree.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)
|
||||
{
|
||||
TreeGX tree = null;
|
||||
if(context.Instance is TreeGX)
|
||||
tree=context.Instance as TreeGX;
|
||||
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
|
||||
}
|
||||
}
|
@@ -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.Tree.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 = 5;
|
||||
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
|
||||
}
|
||||
}
|
@@ -0,0 +1,104 @@
|
||||
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;
|
||||
|
||||
namespace DevComponents.Tree.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();
|
||||
object dotNetBarManager=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.GetType().FullName=="DevComponents.DotNetBar.DotNetBarManager")
|
||||
{
|
||||
dotNetBarManager=component;
|
||||
IList contextMenus=component.GetType().InvokeMember("ContextMenus",
|
||||
System.Reflection.BindingFlags.GetProperty, null, component, null) as IList;
|
||||
if(contextMenus!=null)
|
||||
{
|
||||
foreach(object o in contextMenus)
|
||||
{
|
||||
string name=o.GetType().InvokeMember("Name", System.Reflection.BindingFlags.GetProperty, null, o, null).ToString();
|
||||
if(name!=null)
|
||||
{
|
||||
lb.Items.Add(DotNetBarPrefix+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)["DotNetBarManager"].SetValue(node.TreeControl, dotNetBarManager);
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
195
PROMS/DotNetBar Source Code/TreeGX/Design/NodeDesigner.cs
Normal file
195
PROMS/DotNetBar Source Code/TreeGX/Design/NodeDesigner.cs
Normal file
@@ -0,0 +1,195 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
namespace DevComponents.Tree.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 initalize 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)
|
||||
// {
|
||||
// TreeGXDesigner ds = dh.GetDesigner(node.TreeControl) as TreeGXDesigner;
|
||||
// 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))
|
||||
};
|
||||
return new DesignerVerbCollection(verbs);
|
||||
}
|
||||
}
|
||||
|
||||
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.Primary);
|
||||
node.TreeControl.SelectedNode = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Node CreateNode(Node parentNode)
|
||||
{
|
||||
IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost));
|
||||
if(dh==null)
|
||||
return null;
|
||||
|
||||
Node node=null;
|
||||
TreeGX 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;
|
||||
}
|
||||
}
|
||||
}
|
854
PROMS/DotNetBar Source Code/TreeGX/Design/TreeGXDesigner.cs
Normal file
854
PROMS/DotNetBar Source Code/TreeGX/Design/TreeGXDesigner.cs
Normal file
@@ -0,0 +1,854 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
namespace DevComponents.Tree.Design
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents windows forms designer for the control.
|
||||
/// </summary>
|
||||
public class TreeGXDesigner:ParentControlDesigner
|
||||
{
|
||||
#region Private Variables
|
||||
// private Point m_MouseDownPosition=Point.Empty;
|
||||
// private bool m_IgnoreMouseUp=false;
|
||||
// private bool m_Capture=false;
|
||||
private bool m_DragDropStarted=false;
|
||||
const string TEMP_NAME="tempDragDropItem";
|
||||
const int WM_RBUTTONDOWN=0x0204;
|
||||
const int WM_LBUTTONDOWN=0x0201;
|
||||
// const int WM_LBUTTONUP=0x0202;
|
||||
// const int WM_RBUTTONUP=0x0205;
|
||||
// const int WM_MOUSEMOVE=0x0200;
|
||||
const int WM_LBUTTONDBLCLK=0x0203;
|
||||
|
||||
private Timer m_TimerAdded=null;
|
||||
private Timer m_TimerDragDrop=null;
|
||||
private bool m_DragLeave=false;
|
||||
private bool m_ControlRemoved=false;
|
||||
private DateTime m_JustAdded=DateTime.MinValue;
|
||||
private bool m_NewControlAdded=false;
|
||||
private Point m_MouseDownPoint=Point.Empty;
|
||||
#endregion
|
||||
|
||||
#region Designer Implementation
|
||||
/// <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);
|
||||
|
||||
// If our component is removed we need to clean-up
|
||||
IComponentChangeService cc=(IComponentChangeService)GetService(typeof(IComponentChangeService));
|
||||
if(cc!=null)
|
||||
{
|
||||
cc.ComponentRemoving+=new ComponentEventHandler(this.OnComponentRemoving);
|
||||
}
|
||||
|
||||
if(component is Control)
|
||||
{
|
||||
((Control)component).ControlAdded+=new ControlEventHandler(this.ControlAdded);
|
||||
((Control)component).ControlRemoved+=new ControlEventHandler(this.ControlRemoved);
|
||||
}
|
||||
|
||||
#if !TRIAL
|
||||
IDesignerHost dh = this.GetService(typeof (IDesignerHost)) as IDesignerHost;
|
||||
if(dh!=null)
|
||||
dh.LoadComplete+=new EventHandler(dh_LoadComplete);
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
|
||||
ISelectionService ss =(ISelectionService)GetService(typeof(ISelectionService));
|
||||
if(ss!=null)
|
||||
ss.SelectionChanged-=new EventHandler(OnSelectionChanged);
|
||||
|
||||
// If our component is removed we need to clean-up
|
||||
IComponentChangeService cc=(IComponentChangeService)GetService(typeof(IComponentChangeService));
|
||||
if(cc!=null)
|
||||
cc.ComponentRemoving-=new ComponentEventHandler(this.OnComponentRemoving);
|
||||
|
||||
if(this.Control!=null)
|
||||
{
|
||||
this.Control.ControlAdded-=new ControlEventHandler(this.ControlAdded);
|
||||
this.Control.ControlRemoved-=new ControlEventHandler(this.ControlRemoved);
|
||||
}
|
||||
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
internal void HookControl(Control c)
|
||||
{
|
||||
this.HookChildControls(c);
|
||||
}
|
||||
|
||||
// public override DesignerVerbCollection Verbs
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// DesignerVerb[] verbs = new DesignerVerb[]
|
||||
// {
|
||||
// new DesignerVerb("Create Node", new EventHandler(CreateNode))};
|
||||
// return new DesignerVerbCollection(verbs);
|
||||
// }
|
||||
// }
|
||||
|
||||
public override void InitializeNewComponent(IDictionary defaultValues)
|
||||
{
|
||||
base.InitializeNewComponent(defaultValues);
|
||||
SetDefaults();
|
||||
}
|
||||
|
||||
private void SetDefaults()
|
||||
{
|
||||
CreateNode(null,true);
|
||||
IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost));
|
||||
if(dh==null)
|
||||
return;
|
||||
Utilites.InitializeTree(this.Control as TreeGX,new ComponentFactory(dh));
|
||||
#if !TRIAL
|
||||
string key=GetLicenseKey();
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
tree.LicenseKey=key;
|
||||
#endif
|
||||
}
|
||||
|
||||
private Node CreateNode(Node parentNode, bool addToCollections)
|
||||
{
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
|
||||
IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost));
|
||||
if(dh==null)
|
||||
return null;
|
||||
|
||||
Node node=null;
|
||||
tree.BeginUpdate();
|
||||
try
|
||||
{
|
||||
IComponentChangeService change=this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
|
||||
if(addToCollections)
|
||||
{
|
||||
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(addToCollections)
|
||||
{
|
||||
if(parentNode==null)
|
||||
tree.Nodes.Add(node);
|
||||
else
|
||||
parentNode.Nodes.Add(node);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private void OnSelectionChanged(object sender,EventArgs e)
|
||||
{
|
||||
ISelectionService ss = (ISelectionService)sender;
|
||||
if(ss.PrimarySelection==this.Component)
|
||||
{
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
tree.SelectedNode=null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Called when component is about to be removed from designer.</summary>
|
||||
/// <param name="sender">Event sender.</param>
|
||||
/// <param name="e">Event arguments.</param>
|
||||
public void OnComponentRemoving(object sender,ComponentEventArgs e)
|
||||
{
|
||||
if(e.Component==this.Component)
|
||||
{
|
||||
IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost));
|
||||
if(dh==null)
|
||||
return;
|
||||
|
||||
ArrayList list = new ArrayList(this.AssociatedComponents);
|
||||
foreach(IComponent c in list)
|
||||
dh.DestroyComponent(c);
|
||||
}
|
||||
else if(e.Component is Node && ((Node)e.Component).TreeControl==this.Control)
|
||||
{
|
||||
OnNodeRemoving(e.Component as Node);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnNodeRemoving(Node node)
|
||||
{
|
||||
IComponentChangeService cc=this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
|
||||
IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost));
|
||||
|
||||
if(node.Parent!=null)
|
||||
{
|
||||
Node parent=node.Parent;
|
||||
if(cc!=null)
|
||||
cc.OnComponentChanging(parent,TypeDescriptor.GetProperties(parent)["Nodes"]);
|
||||
node.Remove();
|
||||
if(cc!=null)
|
||||
cc.OnComponentChanged(parent,TypeDescriptor.GetProperties(parent)["Nodes"],null,null);
|
||||
}
|
||||
|
||||
if(node.Nodes.Count>0)
|
||||
{
|
||||
Node[] nodes=new Node[node.Nodes.Count];
|
||||
node.Nodes.CopyTo(nodes);
|
||||
foreach(Node n in nodes)
|
||||
{
|
||||
n.Remove();
|
||||
|
||||
if(n.ParentConnector!=null && dh!=null)
|
||||
dh.DestroyComponent(n.ParentConnector);
|
||||
|
||||
if(dh!=null)
|
||||
dh.DestroyComponent(n);
|
||||
}
|
||||
}
|
||||
|
||||
this.RecalcLayout();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all components associated with this control
|
||||
/// </summary>
|
||||
public override ICollection AssociatedComponents
|
||||
{
|
||||
get
|
||||
{
|
||||
ArrayList c=new ArrayList(base.AssociatedComponents);
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
if(tree!=null)
|
||||
{
|
||||
foreach(Node node in tree.Nodes)
|
||||
GetNodesRecursive(node,c);
|
||||
|
||||
foreach(ElementStyle style in tree.Styles)
|
||||
c.Add(style);
|
||||
|
||||
if(tree.NodesConnector!=null)
|
||||
c.Add(tree.NodesConnector);
|
||||
if(tree.RootConnector!=null)
|
||||
c.Add(tree.RootConnector);
|
||||
if(tree.LinkConnector!=null)
|
||||
c.Add(tree.LinkConnector);
|
||||
if(tree.SelectedPathConnector!=null)
|
||||
c.Add(tree.SelectedPathConnector);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetNodesRecursive(Node parent,ArrayList c)
|
||||
{
|
||||
c.Add(parent);
|
||||
|
||||
if(parent.ParentConnector!=null)
|
||||
c.Add(parent.ParentConnector);
|
||||
foreach(Node node in parent.Nodes)
|
||||
{
|
||||
c.Add(node);
|
||||
if (node.Cells.Count > 1)
|
||||
{
|
||||
for (int i = 1; i < node.Cells.Count; i++)
|
||||
{
|
||||
c.Add(node.Cells[i]);
|
||||
}
|
||||
}
|
||||
if (node.NodesColumns.Count > 0)
|
||||
{
|
||||
foreach (ColumnHeader ch in node.NodesColumns)
|
||||
{
|
||||
c.Add(ch);
|
||||
}
|
||||
}
|
||||
GetNodesRecursive(node,c);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selection support for items on container.
|
||||
/// </summary>
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
switch(m.Msg)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
if(OnMouseDown(ref m,MouseButtons.Left))
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case WM_RBUTTONDOWN:
|
||||
{
|
||||
if(OnMouseDown(ref m,MouseButtons.Right))
|
||||
return;
|
||||
break;
|
||||
}
|
||||
// case WM_LBUTTONUP:
|
||||
// {
|
||||
// if(OnMouseUp(ref m,MouseButtons.Left))
|
||||
// return;
|
||||
// break;
|
||||
// }
|
||||
// case WM_RBUTTONUP:
|
||||
// {
|
||||
// if(OnMouseUp(ref m,MouseButtons.Right))
|
||||
// return;
|
||||
// break;
|
||||
// }
|
||||
// case WM_MOUSEMOVE:
|
||||
// {
|
||||
// if(OnMouseMove(ref m))
|
||||
// return;
|
||||
// break;
|
||||
// }
|
||||
case WM_LBUTTONDBLCLK:
|
||||
{
|
||||
if(OnMouseDoubleClick())
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
private bool OnMouseDoubleClick()
|
||||
{
|
||||
bool processed=false;
|
||||
|
||||
ISelectionService selection = (ISelectionService) this.GetService(typeof(ISelectionService));
|
||||
if(selection.PrimarySelection is Node && ((Node)selection.PrimarySelection).TreeControl==this.Control)
|
||||
{
|
||||
IDesignerHost host=(IDesignerHost) this.GetService(typeof(IDesignerHost));
|
||||
if(host!=null)
|
||||
{
|
||||
IDesigner designer=host.GetDesigner(selection.PrimarySelection as IComponent);
|
||||
if(designer!=null)
|
||||
{
|
||||
designer.DoDefaultAction();
|
||||
processed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
protected virtual bool OnMouseDown(ref Message m, MouseButtons button)
|
||||
{
|
||||
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
|
||||
if(tree==null)
|
||||
return false;
|
||||
|
||||
Point pos=tree.PointToClient(System.Windows.Forms.Control.MousePosition);
|
||||
//m_MouseDownPosition=pos;
|
||||
|
||||
Node node=tree.GetNodeAt(pos);
|
||||
if(node!=null && button==MouseButtons.Right)
|
||||
{
|
||||
ISelectionService selection = (ISelectionService) this.GetService(typeof(ISelectionService));
|
||||
ArrayList arr=new ArrayList(1);
|
||||
arr.Add(node);
|
||||
selection.SetSelectedComponents(arr,SelectionTypes.Primary);
|
||||
|
||||
tree.SelectedNode=node;
|
||||
this.OnContextMenu(System.Windows.Forms.Control.MousePosition.X,System.Windows.Forms.Control.MousePosition.Y);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Specifies selection rules for designer.</summary>
|
||||
public override SelectionRules SelectionRules
|
||||
{
|
||||
get
|
||||
{
|
||||
return (SelectionRules.AllSizeable | SelectionRules.Moveable | SelectionRules.Visible);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Drag & Drop External Control Support
|
||||
private void DestroyComponent(IComponent c)
|
||||
{
|
||||
IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost));
|
||||
if(dh==null)
|
||||
return;
|
||||
dh.DestroyComponent(c);
|
||||
}
|
||||
|
||||
private void RecalcLayout()
|
||||
{
|
||||
TreeGX tree = this.Control as TreeGX;
|
||||
if(tree!=null)
|
||||
{
|
||||
tree.RecalcLayout();
|
||||
tree.Refresh();
|
||||
}
|
||||
}
|
||||
private void ControlAdded(object sender, ControlEventArgs e)
|
||||
{
|
||||
if(!m_NewControlAdded)
|
||||
{
|
||||
if(!m_NewControlAdded)
|
||||
{
|
||||
if(!OnControlAdded(e))
|
||||
return;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
m_TimerAdded=new Timer();
|
||||
m_TimerAdded.Tick+=new EventHandler(this.TimerTick);
|
||||
m_TimerAdded.Interval=50;
|
||||
m_TimerAdded.Enabled=true;
|
||||
m_TimerAdded.Start();
|
||||
m_NewControlAdded=false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called after control has been added to container but not through drag & drop. Control added could also be
|
||||
/// internal control by the bar container.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
/// <returns>true if acted upon this new control otherwise false.</returns>
|
||||
protected virtual bool OnControlAdded(ControlEventArgs e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ControlRemoved(object sender, ControlEventArgs e)
|
||||
{
|
||||
IDesignerHost dh=(IDesignerHost)GetService(typeof(IDesignerHost));
|
||||
if(dh==null || dh.Loading)
|
||||
return;
|
||||
|
||||
if(m_JustAdded!=DateTime.MinValue && DateTime.Now.Subtract(m_JustAdded).Seconds<2)
|
||||
{
|
||||
m_JustAdded=DateTime.MinValue;
|
||||
return;
|
||||
}
|
||||
m_JustAdded=DateTime.MinValue;
|
||||
if(m_DragLeave)
|
||||
ControlRemoved(e.Control);
|
||||
else if(m_TimerDragDrop!=null)
|
||||
m_ControlRemoved=true;
|
||||
else
|
||||
{
|
||||
ISelectionService ss =(ISelectionService)GetService(typeof(ISelectionService));
|
||||
if(ss!=null && ss.PrimarySelection==e.Control && Utilites.FindNodeForControl(this.Control as TreeGX, e.Control)!=null)
|
||||
{
|
||||
ControlRemoved(e.Control);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ControlRemoved(Control control)
|
||||
{
|
||||
TreeGX tree = this.Control as TreeGX;
|
||||
|
||||
if(control!=null)
|
||||
{
|
||||
Node node=Utilites.FindNodeForControl(tree,control);
|
||||
if(node!=null)
|
||||
{
|
||||
if(m_DragDropStarted)
|
||||
{
|
||||
tree.InternalDragLeave();
|
||||
m_DragDropStarted = false;
|
||||
}
|
||||
|
||||
if(node.Parent!=null)
|
||||
{
|
||||
Node parent=node.Parent;
|
||||
IComponentChangeService cc = this.GetService(typeof (IComponentChangeService)) as IComponentChangeService;
|
||||
if(cc!=null)
|
||||
cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["Nodes"]);
|
||||
node.Remove();
|
||||
if(cc!=null)
|
||||
cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["Nodes"],null,null);
|
||||
}
|
||||
|
||||
this.DestroyComponent(node);
|
||||
this.RecalcLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TimerTick(object sender, EventArgs e)
|
||||
{
|
||||
m_TimerAdded.Stop();
|
||||
m_TimerAdded.Enabled=false;
|
||||
m_TimerAdded=null;
|
||||
this.RecalcLayout();
|
||||
ISelectionService sel=(ISelectionService)this.GetService(typeof(ISelectionService));
|
||||
if(sel!=null && sel.PrimarySelection is Control && this.Control.Controls.Contains((Control)sel.PrimarySelection))
|
||||
{
|
||||
IComponentChangeService cc=this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
|
||||
cc.OnComponentChanged(sel.PrimarySelection,null,null,null);
|
||||
}
|
||||
}
|
||||
|
||||
private void TimerTickDragDrop(object sender, EventArgs e)
|
||||
{
|
||||
Point p=this.Control.PointToClient(System.Windows.Forms.Control.MousePosition);
|
||||
if(this.Control.Bounds.Contains(p))
|
||||
m_DragLeave=false;
|
||||
else
|
||||
m_DragLeave=true;
|
||||
|
||||
if(System.Windows.Forms.Control.MouseButtons!=MouseButtons.Left)
|
||||
{
|
||||
m_TimerDragDrop.Enabled=false;
|
||||
m_TimerDragDrop.Stop();
|
||||
m_TimerDragDrop.Tick-=new EventHandler(TimerTickDragDrop);
|
||||
m_TimerDragDrop.Dispose();
|
||||
m_TimerDragDrop=null;
|
||||
if(m_ControlRemoved)
|
||||
{
|
||||
m_ControlRemoved=false;
|
||||
ISelectionService sel=this.GetService(typeof(ISelectionService)) as ISelectionService;
|
||||
if(sel!=null && sel.PrimarySelection is Control)
|
||||
ControlRemoved((Control)sel.PrimarySelection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDragLeave(EventArgs e)
|
||||
{
|
||||
if(m_DragDropStarted)
|
||||
{
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
tree.InternalDragLeave();
|
||||
m_DragDropStarted = false;
|
||||
}
|
||||
base.OnDragLeave (e);
|
||||
}
|
||||
|
||||
protected override void OnDragOver(DragEventArgs de)
|
||||
{
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
if(tree==null)
|
||||
{
|
||||
base.OnDragOver(de);
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_DragDropStarted)
|
||||
{
|
||||
DragEventArgs d=new DragEventArgs(null,de.KeyState,de.X,de.Y,DragDropEffects.All,DragDropEffects.Move);
|
||||
tree.InternalDragOver(d);
|
||||
de.Effect=DragDropEffects.Move;
|
||||
return;
|
||||
}
|
||||
|
||||
ISelectionService sel=(ISelectionService)this.GetService(typeof(ISelectionService));
|
||||
if(sel!=null && sel.PrimarySelection!=this.Component)
|
||||
{
|
||||
if(sel.PrimarySelection is Control && this.Control.Controls.Contains((Control)sel.PrimarySelection))
|
||||
{
|
||||
Node node=Utilites.FindNodeForControl(tree,sel.PrimarySelection as Control);
|
||||
if(node!=null)
|
||||
{
|
||||
if(tree.StartDragDrop(node))
|
||||
{
|
||||
if(m_TimerDragDrop==null)
|
||||
{
|
||||
m_TimerDragDrop=new Timer();
|
||||
m_TimerDragDrop.Tick+=new EventHandler(this.TimerTickDragDrop);
|
||||
m_TimerDragDrop.Interval=100;
|
||||
m_TimerDragDrop.Enabled=true;
|
||||
m_TimerDragDrop.Start();
|
||||
}
|
||||
m_DragDropStarted = true;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if(sel.SelectionCount>1)
|
||||
{
|
||||
de.Effect=DragDropEffects.None;
|
||||
return;
|
||||
}
|
||||
else if(sel.PrimarySelection is Control && ((Control)sel.PrimarySelection).Parent!=null)
|
||||
{
|
||||
// New control being added to the container
|
||||
Node node=new Node();
|
||||
node.Name=TEMP_NAME;
|
||||
node.Text = ((Control) sel.PrimarySelection).Name;
|
||||
if(tree.StartDragDrop(node))
|
||||
m_DragDropStarted = true;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnDragOver (de);
|
||||
}
|
||||
|
||||
protected override void OnDragDrop(DragEventArgs de)
|
||||
{
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
if(tree==null)
|
||||
{
|
||||
base.OnDragDrop(de);
|
||||
return;
|
||||
}
|
||||
|
||||
ISelectionService sel=(ISelectionService)this.GetService(typeof(ISelectionService));
|
||||
if(sel!=null && sel.PrimarySelection is Control && this.Control.Controls.Contains((Control)sel.PrimarySelection))
|
||||
{
|
||||
de.Effect=DragDropEffects.Move;
|
||||
tree.InternalDragDrop(new DragEventArgs(null,0,0,0,DragDropEffects.Move,DragDropEffects.All));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sel.SelectionCount>1)
|
||||
{
|
||||
de.Effect=DragDropEffects.None;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Node node = tree.GetDragNode();
|
||||
if(node!=null && node.Tag is Node && ((Node)node.Tag).Name==TEMP_NAME)
|
||||
{
|
||||
m_JustAdded=DateTime.Now;
|
||||
Node dragNode=CreateNode(null,false);
|
||||
TypeDescriptor.GetProperties(dragNode)["HostedControl"].SetValue(dragNode,sel.PrimarySelection as Control);
|
||||
TypeDescriptor.GetProperties(dragNode)["Text"].SetValue(dragNode,dragNode.HostedControl.Name);
|
||||
node.Tag = dragNode;
|
||||
tree.InternalDragDrop(new DragEventArgs(null,0,0,0,DragDropEffects.Move,DragDropEffects.All));
|
||||
m_NewControlAdded=true;
|
||||
m_DragDropStarted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
base.OnDragDrop(de);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Drag & Drop support
|
||||
/// <summary>
|
||||
/// Called after node has been selected by designer as response to mouse action
|
||||
/// </summary>
|
||||
/// <param name="node">Node that is selected</param>
|
||||
protected virtual void OnNodeSelected(Node node)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether specified node can be dragged and dropped
|
||||
/// </summary>
|
||||
/// <param name="node">Node to verify</param>
|
||||
/// <returns>true if node can be dragged and dropped</returns>
|
||||
protected virtual bool CanDragNode(Node node)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnMouseDragBegin(int x, int y)
|
||||
{
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
if(tree==null)
|
||||
{
|
||||
base.OnMouseDragBegin(x,y);
|
||||
return;
|
||||
}
|
||||
|
||||
Point pos=tree.PointToClient(new Point(x,y));
|
||||
Node node = tree.GetNodeAt(pos);
|
||||
|
||||
if(node!=null)
|
||||
{
|
||||
Rectangle expandedRect=Display.NodeDisplay.GetNodeRectangle(eNodeRectanglePart.ExpandBounds,node,tree.NodeDisplay.Offset);
|
||||
if(!expandedRect.IsEmpty && expandedRect.Contains(pos))
|
||||
{
|
||||
node.Expanded=!node.Expanded;
|
||||
return;
|
||||
}
|
||||
ISelectionService selection = (ISelectionService) this.GetService(typeof(ISelectionService));
|
||||
if(selection!=null)
|
||||
{
|
||||
ArrayList arr=new ArrayList(1);
|
||||
arr.Add(node);
|
||||
selection.SetSelectedComponents(arr,SelectionTypes.Primary);
|
||||
OnNodeSelected(node);
|
||||
}
|
||||
tree.SelectedNode = node;
|
||||
}
|
||||
else
|
||||
tree.SelectedNode = null;
|
||||
|
||||
if(node==null || !CanDragNode(node))
|
||||
{
|
||||
if(node==null)
|
||||
base.OnMouseDragBegin(x,y);
|
||||
else
|
||||
this.Control.Capture = true; // Does same as base implementation
|
||||
return;
|
||||
}
|
||||
|
||||
m_MouseDownPoint=new Point(x,y);
|
||||
this.Control.Capture = true;
|
||||
}
|
||||
|
||||
protected override void OnMouseDragMove(int x, int y)
|
||||
{
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
if(!m_MouseDownPoint.IsEmpty && tree.SelectedNode!=null)
|
||||
{
|
||||
if(Math.Abs(m_MouseDownPoint.X-x)>=SystemInformation.DragSize.Width || Math.Abs(m_MouseDownPoint.Y-y)>=SystemInformation.DragSize.Height)
|
||||
{
|
||||
tree.StartDragDrop(tree.SelectedNode);
|
||||
m_MouseDownPoint=Point.Empty;
|
||||
m_DragDropStarted=true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(m_DragDropStarted)
|
||||
{
|
||||
DragEventArgs de=new DragEventArgs(null,(int)Control.ModifierKeys,x,y,DragDropEffects.All,DragDropEffects.Move);
|
||||
tree.InternalDragOver(de);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseDragEnd(bool cancel)
|
||||
{
|
||||
this.Control.Capture = false;
|
||||
Cursor.Clip = Rectangle.Empty;
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
if(m_DragDropStarted)
|
||||
{
|
||||
if(tree!=null && tree.IsDragDropInProgress)
|
||||
{
|
||||
if(cancel)
|
||||
tree.InternalDragLeave();
|
||||
else if(tree.GetDragNode()!=null)
|
||||
{
|
||||
IComponentChangeService change=this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
|
||||
|
||||
Node dragNode=tree.GetDragNode().Tag as Node;
|
||||
if(dragNode!=null)
|
||||
{
|
||||
Node newParent=tree.GetDragNode().Parent;
|
||||
Node parent=dragNode.Parent;
|
||||
|
||||
if(change!=null)
|
||||
{
|
||||
if(parent!=null)
|
||||
change.OnComponentChanging(this.Component,TypeDescriptor.GetProperties(parent).Find("Nodes",true));
|
||||
else
|
||||
change.OnComponentChanging(this.Component,TypeDescriptor.GetProperties(tree).Find("Nodes",true));
|
||||
|
||||
if(newParent!=null)
|
||||
change.OnComponentChanging(this.Component,TypeDescriptor.GetProperties(newParent).Find("Nodes",true));
|
||||
else
|
||||
change.OnComponentChanging(this.Component,TypeDescriptor.GetProperties(tree).Find("Nodes",true));
|
||||
}
|
||||
|
||||
tree.InternalDragDrop(new DragEventArgs(null,0,0,0,DragDropEffects.None,DragDropEffects.None));
|
||||
|
||||
newParent = dragNode.Parent;
|
||||
|
||||
if(change!=null)
|
||||
{
|
||||
if(parent!=null)
|
||||
change.OnComponentChanged(this.Component,TypeDescriptor.GetProperties(parent).Find("Nodes",true),null,null);
|
||||
else
|
||||
change.OnComponentChanged(this.Component,TypeDescriptor.GetProperties(tree).Find("Nodes",true),null,null);
|
||||
if(newParent!=null)
|
||||
change.OnComponentChanged(this.Component,TypeDescriptor.GetProperties(newParent).Find("Nodes",true),null,null);
|
||||
else
|
||||
change.OnComponentChanged(this.Component,TypeDescriptor.GetProperties(tree).Find("Nodes",true),null,null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cancel=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(tree.SelectedNode!=null)
|
||||
cancel=true;
|
||||
}
|
||||
|
||||
m_DragDropStarted = false;
|
||||
base.OnMouseDragEnd(cancel);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Licensing Stuff
|
||||
#if !TRIAL
|
||||
private string GetLicenseKey()
|
||||
{
|
||||
string key="";
|
||||
Microsoft.Win32.RegistryKey regkey=Microsoft.Win32.Registry.LocalMachine;
|
||||
regkey=regkey.OpenSubKey("Software\\DevComponents\\Licenses",false);
|
||||
if(regkey!=null)
|
||||
{
|
||||
object keyValue=regkey.GetValue("DevComponents.Tree.TreeGX");
|
||||
if(keyValue!=null)
|
||||
key=keyValue.ToString();
|
||||
}
|
||||
return key;
|
||||
}
|
||||
private void dh_LoadComplete(object sender, EventArgs e)
|
||||
{
|
||||
IDesignerHost dh = this.GetService(typeof (IDesignerHost)) as IDesignerHost;
|
||||
if(dh!=null)
|
||||
dh.LoadComplete-=new EventHandler(dh_LoadComplete);
|
||||
|
||||
string key=GetLicenseKey();
|
||||
TreeGX tree=this.Control as TreeGX;
|
||||
if(key!="" && tree!=null && tree.LicenseKey=="" && tree.LicenseKey!=key)
|
||||
TypeDescriptor.GetProperties(tree)["LicenseKey"].SetValue(tree,key);
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user