[Adapdev-commits] Adapdev/src/Adapdev.Windows.Forms SmartTreeView.cs,NONE,1.1 SmartTreeView.resx,NON
Status: Beta
Brought to you by:
intesar66
From: Sean M. <int...@us...> - 2005-05-25 05:17:57
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Windows.Forms Modified Files: Adapdev.Windows.Forms.csproj Added Files: SmartTreeView.cs SmartTreeView.resx Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation Index: Adapdev.Windows.Forms.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/Adapdev.Windows.Forms.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Adapdev.Windows.Forms.csproj 14 Apr 2005 03:32:07 -0000 1.4 --- Adapdev.Windows.Forms.csproj 25 May 2005 05:17:48 -0000 1.5 *************** *** 186,189 **** --- 186,199 ---- /> <File + RelPath = "SmartTreeView.cs" + SubType = "Component" + BuildAction = "Compile" + /> + <File + RelPath = "SmartTreeView.resx" + DependentUpon = "SmartTreeView.cs" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "SmoothProgressBar.cs" SubType = "UserControl" --- NEW FILE: SmartTreeView.resx --- <?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="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="$this.Name"> <value>SmartTreeView</value> </data> <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> </root> --- NEW FILE: SmartTreeView.cs --- using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; namespace Adapdev.Windows.Forms { public class SmartTreeView : System.Windows.Forms.TreeView { private System.ComponentModel.IContainer components = null; private bool disableAfterSelect = false; private Color checkedFont = Color.Black; private Color uncheckedFont = Color.LightGray; public SmartTreeView() { InitializeComponent(); } /// <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 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() { // // SmartTreeView // this.CheckBoxes = true; this.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.SmartTreeView_AfterCheck); } #endregion private void SmartTreeView_AfterCheck(object sender, System.Windows.Forms.TreeViewEventArgs e) { if(!this.disableAfterSelect) { if(e.Node.Checked) CheckParents(e.Node); // Required to avoid a stack overflow this.disableAfterSelect = true; // Check / Uncheck all children CheckChildren(e.Node); this.disableAfterSelect = false; } } private void CheckParents(TreeNode node) { TreeNode treeNode = node; while(treeNode.Parent != null) { // Set the parent to the child's checked state treeNode.Parent.Checked = node.Checked; // Change the state this.ChangeForeColor(treeNode); // Process the parent treeNode = treeNode.Parent; } } private void CheckChildren(TreeNode node) { if(node != null && node.Nodes.Count > 0) { foreach(TreeNode child in node.Nodes) { // Change the checked state to that of the parent child.Checked = node.Checked; // Change the state this.ChangeForeColor(node); // Check all children CheckChildren(child); } } } private void ChangeForeColor(TreeNode node) { if(node.Checked) node.ForeColor = this.CheckedForeColor; else node.ForeColor = this.UncheckedForeColor; } [Category("Appearance"), Description("Sets the font forecolor when the node is checked."), DefaultValue(typeof(Color), "Color.Black"), Browsable(true)] public Color CheckedForeColor { get { return checkedFont; } set { checkedFont = value; } } [Category("Appearance"), Description("Sets the font forecolor when the node is unchecked."), DefaultValue(typeof(Color), "Color.LightGray"), Browsable(true)] public Color UncheckedForeColor { get { return uncheckedFont; } set { uncheckedFont = value; } } } } |