/// <summary> /// constructeur par défaut /// </summary> /// <param name="aOwner"></param> public SearchHelper(GeniusTreeView aOwner) { FOwner = aOwner; FBuffer = string.Empty; FCurrentDirection = FOwner.SearchDirection; FInit = false; }
/// <summary> /// spécification d'un fonte différente en fonction du niveau /// </summary> /// <param name="Sender"></param> /// <param name="e"></param> void gtv_OnGetFontNode(GeniusTreeView Sender, NodeFontEventArgs e) { if (e.Node.Level == 2) { e.Font = new Font(e.Font.Name, e.Font.SizeInPoints); } }
void gtv_OnBeforePainting(GeniusTreeView Sender, PaintNodeEventArgs e) { //painture du dégradé dans le fond du control GeniusLinearGradientBrush br = new GeniusLinearGradientBrush(Color.FromArgb(243, 241, 230), Color.FromArgb(227, 225, 208)); e.Info.graphics.FillRectangle(br.GetBrush(this.ClientRectangle), this.ClientRectangle); }
/// <summary> /// constructeur par défaut /// </summary> /// <param name="tv"></param> public GeniusTreeViewEditorBase(GeniusTreeView tv) { FTreeView = tv; FControl = CreateEditorControl(); FControl.Visible = false; FControl.Parent = FTreeView; FKeysHook = null; FHook = IntPtr.Zero; }
private void geniusTreeView1_OnAfterEdit(GeniusTreeView Sender, EditEventArgs e) { object value = e.Editor.Value; /* * if (value != null) * edTrace.AppendText("AfterEdit :" + value.ToString()+Environment.NewLine); */ }
/// <summary> /// constrcuteur par défaut /// </summary> /// <param name="treeView"></param> public BaseHintWindow(GeniusTreeView treeView) : base(treeView) { if (treeView == null) { throw new ArgumentNullException("treeView"); } FFont = (Font)treeView.Font.Clone(); FCalculateSizeNeeded = false; }
private void geniusTreeView1_OnInitEdit(GeniusTreeView Sender, EditEventArgs e) { if (e.Editor != null && e.Editor.Control is ComboBox && e.DisplayColumn == 2) { (e.Editor.Control as ComboBox).Items.Clear(); (e.Editor.Control as ComboBox).Items.Add("Item 1"); (e.Editor.Control as ComboBox).Items.Add("Item 2"); (e.Editor.Control as ComboBox).Items.Add("Item 3"); } }
private void geniusTreeView1_OnAfterCheck(GeniusTreeView Sender, NodeEventArgs e) { INode n = e.Node.Parent; foreach (INode child in n.Enumerable.GetVisibleNodes(false)) { if (child != e.Node) { child.State &= ~NodeState.Checked; } } }
public DragForm(Image bmp, GeniusTreeView tv) : base(tv) { FBmp = bmp; FAttr = new ImageAttributes(); FMatrix = new ColorMatrix(); FMatrix.Matrix00 = 1.00f; // Red FMatrix.Matrix11 = 1.00f; // Green FMatrix.Matrix22 = 1.00f; // Blue //permet de rendre transparent le bitmap, par rapport à la couleur de fond //ainsi quand le drag est interdit le dessin est "rougeatre" FMatrix.Matrix33 = 0.5f; // alpha FMatrix.Matrix44 = 1.0f; // w FAttr.SetColorMatrix(FMatrix); }
private void geniusTreeView1_OnCreateEditor(GeniusTreeView Sender, NodeEditorEventArgs e) { if (e.DisplayColumn == 2) { e.Editor = new ComboBoxEditor(geniusTreeView1); } else if (e.DisplayColumn == 1) { e.Editor = new MyDateEditor(geniusTreeView1); } else if (e.DisplayColumn == 0 && e.Node.Level == 2) { e.Editor = new MyUCEditor(geniusTreeView1); } }
public void Deserialize(GeniusTreeView tree, INode aParent) { INode n = tree.Add(aParent, Text, UserData); //le flags visible ne peut être changé par ce biais n.State = this.State; if (((this.State & NodeState.Visible) != NodeState.Visible)) { tree.SetVisibleNode(n, false); } n.Height = this.Height; n.ImageIndex = this.ImageIndex; n.ImageStateIndex = this.ImageStateIndex; if (Children != null) { foreach (SerializableNode child in Children) { child.Deserialize(tree, n); } } }
void gtv_OnPaintNodeBackGround(GeniusTreeView Sender, PaintNodeEventArgs e) { //paint du noeud racine if (e.Node.Level == 1) { using (GeniusLinearGradientBrush br = new GeniusLinearGradientBrush(Color.FromArgb(220, 221, 203), Color.FromArgb(196, 193, 176), 90)) { Rectangle r = e.Info.NodeRect; r.Inflate(0, -1); r.Height -= 1; using (Brush b = br.GetBrush(r)) { e.Info.graphics.FillRectangle(b, r); using (Pen p = new Pen(Color.FromArgb(220, 221, 203))) { e.Info.graphics.DrawLine(p, r.Left, r.Top, r.Right, r.Top); } using (Pen p = new Pen(b)) { e.Info.graphics.DrawLine(p, r.Left, r.Bottom + 1, r.Right, r.Bottom + 1); } } } } else if (e.Node.Level == 2) { //painture du noeud sous la souris ou du noeud selectionné if (e.Node == FUnderMouse || e.Node == FSelected) { Rectangle r = e.Info.NodeRect; r.Inflate(-4, 0); r.Height -= 1; e.Info.graphics.FillRectangle(e.Node == FUnderMouse ? FOverBrush : FSelectedBrush, r); e.Info.graphics.DrawRectangle(FSelLinePen, r); } } }
public void Deserialize(GeniusTreeView tree) { tree.BeginUpdate(); try { tree.Clear(); if (!OnlyChild) { Deserialize(tree, null); } else { foreach (SerializableNode child in Children) { child.Deserialize(tree, null); } } } finally { tree.EndUpdate(); } }
public MyUCEditor(GeniusTreeView tv) : base(tv) { }
public MyDateEditor(GeniusTreeView tv) : base(tv) { }
/// <summary> /// charge les noeuds d'une arbre depuis un fichier, les insères en dessous de aParent /// </summary> /// <param name="tree"></param> /// <param name="aFileName"></param> /// <param name="aParent"></param> public static void DeSerialize(GeniusTreeView tree, string aFileName, INode aParent) { new SerializationHelper(tree).Load(aFileName, aParent); }
/// <summary> /// charge les noeuds d'une arbre depuis un fichier, l'arbre est préalablement vidé /// </summary> /// <param name="tree"></param> /// <param name="aStream"></param> public static void DeSerialize(GeniusTreeView tree, Stream aStream) { new SerializationHelper(tree).Load(aStream); }
private void geniusTreeView1_OnBeforeEdit(GeniusTreeView Sender, CanEditEventArgs e) { // }
/// <summary> /// constructeur par défaut /// </summary> /// <param name="treeView"></param> public DateTimeEditor(GeniusTreeView treeView) : base(treeView) { }
private void gtv_OnItemMouseLeave(GeniusTreeView Sender, NodeCellMouseEventArgs e) { textBox1.AppendText(string.Format("gtv_OnItemMouseLeave({0})\r\n", e.Node.Text)); }
/// <summary> /// sérialize un sous-arbre d'un treeview dans un fichier /// </summary> /// <param name="tree">le treeview concerné</param> /// <param name="aStream">le flux pour la sauvegarde</param> /// <param name="aNode">le noeud a partir duquel la sauvegarde s'effectue</param> /// <param name="onlyChild">sauvegarde des fils et sous fils uniquement, si la valeur vaux vrai, à la relecture "aNode" ne sera pas pris en compte</param> public static void Serialize(GeniusTreeView tree, Stream aStream, INode aNode, bool onlyChild) { SerializationHelper.Save(aStream, aNode, onlyChild); }
public HintImageWindow(GeniusTreeView gtv) : base(gtv) { }
/// <summary> /// constructeur par défaut /// </summary> /// <param name="tv"></param> public GeniusTreeViewEditor(GeniusTreeView tv) : base(tv) { }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.geniusTreeView1 = new Genius.Controls.TreeView.GeniusTreeView(); this.geniusTreeViewColonne1 = new Genius.Controls.TreeView.GeniusTreeViewColonne(); this.geniusTreeViewColonne2 = new Genius.Controls.TreeView.GeniusTreeViewColonne(); this.geniusTreeViewColonne3 = new Genius.Controls.TreeView.GeniusTreeViewColonne(); this.SuspendLayout(); // GeniusTreeView By Pierrick Gourlain // // geniusTreeView1 // this.geniusTreeView1.Alignment = System.Drawing.StringAlignment.Near; this.geniusTreeView1.AutoSort = false; this.geniusTreeView1.BackColor = System.Drawing.SystemColors.Window; this.geniusTreeView1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.geniusTreeView1.Colors.HeaderColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.White, System.Drawing.Color.LightGray, 90F); this.geniusTreeView1.Colors.SelectedColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.SystemColors.Highlight, System.Drawing.Color.Empty, 0F); this.geniusTreeView1.Colors.SelectedTextColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.SystemColors.HighlightText, System.Drawing.Color.Empty, 0F); this.geniusTreeView1.Colors.SelectedUnfocusedColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.SystemColors.InactiveCaption, System.Drawing.Color.Empty, 0F); this.geniusTreeView1.Colors.SignaledPenColor = new Genius.Controls.TreeView.Colors.GeniusPen(System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(165)), ((System.Byte)(0))), 2F); this.geniusTreeView1.Colors.TextColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Black, System.Drawing.Color.Empty, 0F); this.geniusTreeView1.DefaultDrawingOption = Genius.Controls.TreeView.DrawingOptions.ShowGridLines; this.geniusTreeView1.Dock = System.Windows.Forms.DockStyle.Fill; this.geniusTreeView1.Header.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.geniusTreeView1.Header.MainColumnIndex = 0; this.geniusTreeView1.HeaderColonnes.AddRange(new Genius.Controls.TreeView.GeniusTreeViewColonne[] { this.geniusTreeViewColonne1, this.geniusTreeViewColonne2, this.geniusTreeViewColonne3 }); this.geniusTreeView1.KeysGridMode = false; this.geniusTreeView1.Location = new System.Drawing.Point(0, 0); this.geniusTreeView1.Name = "geniusTreeView1"; this.geniusTreeView1.ShowHeader = true; this.geniusTreeView1.Size = new System.Drawing.Size(376, 328); this.geniusTreeView1.TabIndex = 0; this.geniusTreeView1.Text = "geniusTreeView1"; this.geniusTreeView1.UseColumns = true; this.geniusTreeView1.OnInitEdit += new Genius.Controls.TreeView.OnInitEditDelegate(this.geniusTreeView1_OnInitEdit); this.geniusTreeView1.OnCreateEditor += new Genius.Controls.TreeView.OnCreateEditorDelegate(this.geniusTreeView1_OnCreateEditor); this.geniusTreeView1.OnAfterCheck += new Genius.Controls.TreeView.OnNodeDelegate(this.geniusTreeView1_OnAfterCheck); this.geniusTreeView1.OnBeforeEdit += new Genius.Controls.TreeView.OnCanEditDelegate(this.geniusTreeView1_OnBeforeEdit); this.geniusTreeView1.OnAfterEdit += new Genius.Controls.TreeView.OnAfterEditDelegate(this.geniusTreeView1_OnAfterEdit); // // geniusTreeViewColonne1 // this.geniusTreeViewColonne1.BackColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Empty, System.Drawing.Color.Empty, 0F); this.geniusTreeViewColonne1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.geniusTreeViewColonne1.FontColonne = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.geniusTreeViewColonne1.ForeColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Black, System.Drawing.Color.Empty, 0F); this.geniusTreeViewColonne1.HeadColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Empty, System.Drawing.Color.Empty, 0F); this.geniusTreeViewColonne1.Text = "TreeColumn"; this.geniusTreeViewColonne1.Width = 200; // // geniusTreeViewColonne2 // this.geniusTreeViewColonne2.BackColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Empty, System.Drawing.Color.Empty, 0F); this.geniusTreeViewColonne2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.geniusTreeViewColonne2.FontColonne = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.geniusTreeViewColonne2.ForeColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Black, System.Drawing.Color.Empty, 0F); this.geniusTreeViewColonne2.HeadColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Empty, System.Drawing.Color.Empty, 0F); this.geniusTreeViewColonne2.Text = "TextEditor"; // // geniusTreeViewColonne3 // this.geniusTreeViewColonne3.BackColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Empty, System.Drawing.Color.Empty, 0F); this.geniusTreeViewColonne3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.geniusTreeViewColonne3.FontColonne = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.geniusTreeViewColonne3.ForeColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Black, System.Drawing.Color.Empty, 0F); this.geniusTreeViewColonne3.HeadColor = new Genius.Controls.GeniusLinearGradientBrush(System.Drawing.Color.Empty, System.Drawing.Color.Empty, 0F); this.geniusTreeViewColonne3.Text = "ComboEditor"; // // DemoEditors // this.Controls.Add(this.geniusTreeView1); this.Name = "DemoEditors"; this.Size = new System.Drawing.Size(376, 328); this.Load += new System.EventHandler(this.DemoEditors_Load); this.ResumeLayout(false); }
private void GtvToolbox2005_Load(object sender, EventArgs e) { gtv = new GeniusTreeView(); gtv.DefaultNodeHeight = 17; gtv.Dock = DockStyle.Fill; gtv.AllowEdit = false; gtv.Font = new Font("Tahoma", 8, FontStyle.Bold); this.Controls.Add(gtv); gtv.OnBeforePainting += new OnPaintNodeDelegate(gtv_OnBeforePainting); gtv.OnPaintNodeBackGround += new OnPaintNodeDelegate(gtv_OnPaintNodeBackGround); gtv.OnGetFontNode += new OnNodeFontDelegate(gtv_OnGetFontNode); gtv.MouseMove += new MouseEventHandler(gtv_MouseMove); gtv.Click += new EventHandler(gtv_Click); gtv.ImageList = imageList1; gtv.BeginUpdate(); gtv.DefaultDrawingOption = DrawingOptions.HideTreeLines | DrawingOptions.AlwaysHideSelection | DrawingOptions.HideFocusRect; try { INode n = gtv.Add(null, "All Windows Forms", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; n = gtv.Add(null, "Common Controls", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; n = gtv.Add(null, "Containers", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; n = gtv.Add(null, "Menus & Toolbars", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; n = gtv.Add(null, "Data", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; n = gtv.Add(null, "Components", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; n = gtv.Add(null, "Printing", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; n = gtv.Add(null, "Dialogs", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; n = gtv.Add(null, "Crystal Reports", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; n = gtv.Add(null, "Genius", null); INode child = gtv.Add(n, "Pointer", null); child.Height = 20; child.ImageIndex = 0; child = gtv.Add(n, "GeniusTreeView", null); child.Height = 20; child.ImageIndex = 1; n = gtv.Add(null, "General", null); n = gtv.Add(n, "Pointer", null); n.Height = 20; n.ImageIndex = 0; } finally { gtv.EndUpdate(); } }
/// <summary> /// charge les noeuds d'une arbre depuis un flux, les insères en dessous de aParent /// </summary> /// <param name="tree"></param> /// <param name="aStream"></param> /// <param name="aParent"></param> public static void DeSerialize(GeniusTreeView tree, Stream aStream, INode aParent) { new SerializationHelper(tree).Load(aStream, aParent); }
/// <summary> /// sérialize les noeuds d'un treeview dans un fichier, celui -ci est détruit s'il existe /// </summary> /// <param name="tree">le treeview à sauvegarder</param> /// <param name="aFileName">le nom du fichier</param> public static void Serialize(GeniusTreeView tree, string aFileName) { new SerializationHelper(tree).Save(aFileName); }
/// <summary> /// sérialize un sous-arbre d'un treeview dans un fichier /// </summary> /// <param name="tree">le treeview concerné</param> /// <param name="aFileName">le nom du fichier pour la sauvegarde</param> /// <param name="aNode">le noeud a partir duquel la sauvegarde s'effectue</param> /// <param name="onlyChild">sauvegarde des fils et sous fils uniquement, si la valeur vaux vrai, à la relecture "aNode" ne sera pas pris en compte</param> public static void Serialize(GeniusTreeView tree, string aFileName, INode aNode, bool onlyChild) { new SerializationHelper(tree).Save(aFileName, aNode, onlyChild); }
/// <summary> /// constructeur par défaut /// </summary> /// <param name="treeView"></param> public ComboBoxEditor(GeniusTreeView treeView) : base(treeView) { }
private void gtv_OnInitNode(GeniusTreeView Sender, NodeEventArgs e) { e.Node.State |= NodeState.HasCheck; }