예제 #1
0
        private void gtv_OnBeforeNodePainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
        {
            if (e.Node.Data is VistaGroup)
            {
                Rectangle  r;
                VistaGroup group = e.Node.Data as VistaGroup;
                e.Info.DefaultDrawing = false;
                //painture du noeud sous la souris ou du noeud selectionné
                if (e.Node == FUnderMouse || IsSelected(e.Node))
                {
                    r = e.Info.NodeRect;
                    r.Inflate(-2, 0);
                    r.Height -= 1;

                    //RoundRect
                    GeniusLinearGradientBrush geniusBr = e.Node == FUnderMouse ? FOverBrush : FSelectedBrush;
                    DrawRoundRect(geniusBr, FSelLinePen, r, e.Info.graphics);
                }
                SizeF size = e.Info.graphics.MeasureString(group.Name, gtv.Font);
                e.Info.graphics.DrawString(group.Name, gtv.Font, Brushes.Black, e.Info.NodeRect.X + 5, e.Info.NodeRect.Y + e.Info.NodeRect.Height / 2 - size.Height / 2);
                int y = (e.Info.ContentRect.Bottom + e.Info.ContentRect.Top) / 2;
                int x = (int)size.Width + e.Info.ContentRect.X + 10;
                e.Info.graphics.DrawLine(Pens.LightGray, x, y, e.Info.ContentRect.Right - 25, y);
                //dessin des ligne des colonne
                //à faire
                x = e.Info.NodeRect.Left;
                foreach (GeniusTreeViewColonne aCol in gtv.Header.Displays)
                {
                    e.Info.graphics.DrawLine(gtv.Colors.GridLinesColor, x, e.Info.NodeRect.Top, x, e.Info.NodeRect.Bottom);
                    x += aCol.Width;
                }
                //e.Info.graphics.DrawLine(gtv.Colors.GridLinesColor, e.Info.NodeRect.Left, e.Info.NodeRect.Top, e.Info.NodeRect.Left, e.Info.NodeRect.Bottom);
                //dessin de l'expand à droite
                Pen p = new Pen(Brushes.Gray);
                p.Width  = 3;
                p.EndCap = LineCap.ArrowAnchor;
                r        = new Rectangle(e.Info.ContentRect.Right - 15, y, 0, 0);
                r.Inflate(7, 7);
                Debug.WriteLine(string.Format("m : {0}, r:{1}", e.Info.MousePosition, r));
                if (r.Contains(e.Info.MousePosition))
                {
                    using (Brush br = FSelectedBrush.GetBrush(r))
                    {
                        e.Info.graphics.FillEllipse(br, r);
                        e.Info.graphics.DrawEllipse(Pens.LightGray, r);
                    }
                }
                if (e.Node.IsExpanded)
                {
                    e.Info.graphics.DrawLine(p, e.Info.ContentRect.Right - 15, y + 2, e.Info.ContentRect.Right - 15, y - 3);
                }
                else
                {
                    e.Info.graphics.DrawLine(p, e.Info.ContentRect.Right - 15, y - 2, e.Info.ContentRect.Right - 15, y + 3);
                }
            }
        }
예제 #2
0
 private static void GroupEnumerationBy(ArrayList result, GroupBy by)
 {
     if (by == GroupBy.Name)
     {
         ArrayList  a = new ArrayList();
         VistaGroup g = new VistaGroup("A-H");
         a.Add(g);
         AddToGroup(g.FChilds, by, result, "a", "i");
         g = new VistaGroup("I-P");
         a.Add(g);
         AddToGroup(g.FChilds, by, result, "i", "q");
         g = new VistaGroup("Q-Z");
         a.Add(g);
         AddToGroup(g.FChilds, by, result, "q", "z");
         g = new VistaGroup("_others");
         a.Add(g);
         g.FChilds.AddRange(result.ToArray());
         result.Clear();
         result.AddRange(a.ToArray());
     }
     else if (by == GroupBy.Type)
     {
         IDictionary dico = new Hashtable();
         foreach (VistaItemFS item in result)
         {
             string fileType = item.FileType;
             if (fileType != null && fileType.StartsWith("."))
             {
                 fileType = fileType.Substring(1);
             }
             VistaGroup group = dico[fileType] as VistaGroup;
             if (group == null)
             {
                 group          = new VistaGroup(fileType);
                 dico[fileType] = group;
             }
             group.FChilds.Add(item);
         }
         result.Clear();
         result.AddRange(dico.Values);
     }
 }