コード例 #1
0
 private void gtv_OnBeforeCellPainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     if (e.Info.DisplayColumn == 0)
     {
         if (e.Node.IsExpanded || (e.Node.NextSibling != null && e.Node.Level == 2))
         {
             e.Info.CellGridLines = Lines.Vertical;
         }
         if ((e.Node.Level == 2 && e.Node.NextSibling == null))
         {
             e.Info.CellGridLines = Lines.Vertical | Lines.Bottom;
         }
     }
 }
コード例 #2
0
 private void gtv_OnBeforeNodePainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     if (e.Node.Level == 2)
     {
         //
         e.Info.DrawingOptions = DrawingOption.HideTreeLines;
     }
 }
コード例 #3
0
 private void gtv_OnBeforeNodePainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     //
 }
コード例 #4
0
ファイル: demoLonghornUC.cs プロジェクト: pgourlain/treeview
        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);
                }
            }
        }
コード例 #5
0
 private void gtv_OnAfterCellPainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     //e.Info.DrawingOptions = DrawingOption.HideTreeLines;
 }
コード例 #6
0
ファイル: TestChapter.cs プロジェクト: pgourlain/treeview
 private void geniusTreeView1_OnBeforeCellPainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     if (e.Node.Level == 2)
     {
         e.Info.StringFormat.FormatFlags   = 0;
         e.Info.StringFormat.LineAlignment = StringAlignment.Near;
     }
     else if (e.Node.Level == 1)
     {
         e.Info.StringFormat.Trimming = StringTrimming.EllipsisCharacter;
     }
 }
コード例 #7
0
ファイル: demoLonghornUC.cs プロジェクト: pgourlain/treeview
        private void gtv_OnPaintNodeBackGround(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
        {
            //painture du noeud sous la souris ou du noeud selectionné
            if ((e.Node == FUnderMouse || IsSelected(e.Node) && !(e.Node.Data is VistaGroup)))
            {
                Rectangle r = e.Info.NodeRect;
                r.Width = gtv.RangeX;
                r.Inflate(-2, 0);
                r.Height -= 1;

                //RoundRect
                GeniusLinearGradientBrush geniusBr = e.Node == FUnderMouse ? FOverBrush : FSelectedBrush;
                DrawRoundRect(geniusBr, FSelLinePen, r, e.Info.graphics);
            }
        }
コード例 #8
0
 private void geniusTreeView1_OnAfterCellPainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     if (e.Node.Index == 9)
     {
         RectangleF r     = e.Info.graphics.ClipBounds;
         Rectangle  rclip = e.Info.NodeRect;
         rclip.Inflate(0, 1);
         e.Info.graphics.SetClip(rclip);
         Point p1 = new Point(e.Info.NodeRect.X, e.Info.NodeRect.Bottom);
         Point p2 = new Point(e.Info.NodeRect.Right, e.Info.NodeRect.Bottom);
         e.Info.graphics.DrawLine(geniusTreeView1.Colors.GridLinesColor, p1, p2);
         p1 = new Point(e.Info.NodeRect.X, e.Info.NodeRect.Top);
         p2 = new Point(e.Info.NodeRect.Right, e.Info.NodeRect.Top);
         e.Info.graphics.DrawLine(geniusTreeView1.Colors.GridLinesColor, p1, p2);
     }
 }
コード例 #9
0
ファイル: TestChapter.cs プロジェクト: pgourlain/treeview
        private void geniusTreeView1_OnBeforeNodePainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
        {
            e.Info.StringFormat = new StringFormat();
            e.Info.StringFormat.LineAlignment = StringAlignment.Near;

            /*if (e.Node.Level == 1)
             * {
             *      e.Info.Font	= new Font("Times News Roman", 20, FontStyle.Bold);
             * }
             */
        }
コード例 #10
0
 private void geniusTreeView1_OnBeforeCellPainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     if (e.Node.Index != 9)
     {
         if (e.Info.DisplayColumn != 0)
         {
             e.Info.StringFormat.Alignment = StringAlignment.Far;
         }
         if ((e.Info.DisplayColumn % 2 == 0 && e.Node.Index % 2 == 0) ||
             (e.Info.DisplayColumn % 2 == 1 && e.Node.Index % 2 == 1))
         {
             e.Info.BackColor = new GeniusLinearGradientBrush(Color.LightBlue, Color.White);
         }
         else
         {
             e.Info.BackColor = GeniusLinearGradientBrush.Empty;
         }
     }
     else
     {
         e.Info.StringFormat.Alignment = StringAlignment.Far;
         e.Info.BackColor = new GeniusLinearGradientBrush(Color.WhiteSmoke);
         if (e.Info.DisplayColumn < 2)
         {
             e.Info.DefaultDrawing = false;
         }
         if (e.Info.DisplayColumn >= 1)
         {
             e.Info.DrawingOptions |= DrawingOption.ShowGridLines;
         }
     }
 }
コード例 #11
0
 private void geniusTreeView1_OnBeforeNodePainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     if (e.Node.Data is Group)
     {
         Graphics g = e.Info.graphics;
         using (Font f = new Font(this.Font.Name, this.Font.Size, FontStyle.Bold))
         {
             StringFormat sf = new StringFormat(StringFormatFlags.NoWrap);
             sf.LineAlignment = StringAlignment.Center;
             g.DrawString(e.Node.Text, f, Brushes.Black, e.Info.NodeRect, sf);
         }
         Rectangle r = e.Info.NodeRect;
         r.Width /= 2;
         GeniusLinearGradientBrush glb = new GeniusLinearGradientBrush(Color.LightBlue, Color.White);
         using (Brush br = glb.GetBrush(r))
         {
             using (Pen p = new Pen(br, 1))
             {
                 g.DrawLine(p, r.X, r.Bottom - 1, r.Right - 1, r.Bottom - 1);
             }
         }
         e.Info.Font           = null;
         e.Info.DefaultDrawing = false;
     }
     else
     {
         if (e.Node.Data is GroupTotal)
         {
             e.Info.DrawingOptions &= ~DrawingOption.ShowGridLines;
             e.Info.Font            = new Font(this.geniusTreeView1.Font.Name, this.geniusTreeView1.Font.Size, FontStyle.Bold);
         }
         e.Info.DefaultDrawing = true;
     }
 }
コード例 #12
0
        private void geniusTreeView1_OnDrawCellNode(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
        {
            int colindex;

            colindex = Sender.Header.DisplayIndexToIndex(e.Info.DisplayColumn);
            DataNodeImage data = e.Node.Data as DataNodeImage;

            if (data != null)
            {
                if (colindex == 1)
                {
                    e.Info.DefaultDrawing = false;
                    LoadBitmap(data);
                    //e.graphics.DrawImage(data.Bmp, e.CellRect);

                    Rectangle destRect = new Rectangle(e.Info.NodeRect.Location, data.Bmp.Size);
                    int       offsetx  = (e.Info.NodeRect.Width - data.Bmp.Size.Width) / 2;
                    destRect.Offset(offsetx, 0);
                    e.Info.graphics.DrawImage(data.Bmp, destRect, 0, 0, data.Bmp.Size.Width, data.Bmp.Size.Height, GraphicsUnit.Pixel);
                }
            }
            else if (colindex == 1)
            {
                bool selected = false;
                e.Info.DefaultDrawing = false;
                System.Random rnd = new Random();
                Rectangle     r   = e.Info.NodeRect;
                if ((e.Node.State & NodeState.Selected) == NodeState.Selected && geniusTreeView1.SelectedColumn == 1)
                {
                    selected = true;
                    geniusTreeView1.DrawSelectedRectangle(e.Info.graphics, e.Info.NodeRect, true, e.Info);
                }
                r.Y      += 1;
                r.Height -= 1;
                r.Inflate(-2, -5);
                r.Width = rnd.Next(r.Width) + 1;                 //car je ne veux pas de zéro
                int pourcent = (int)(((double)r.Width / (double)(e.Info.NodeRect.Width - 4)) * 100);
                using (GeniusLinearGradientBrush br = new GeniusLinearGradientBrush(Color.Blue, Color.LightBlue, 90))
                {
                    using (Brush b = br.GetBrush(r))
                    {
                        /*
                         * Pen p = new Pen(b, r.Height);
                         * p.DashCap = DashCap.Flat;
                         * p.DashStyle = DashStyle.Custom;
                         * p.DashPattern = new float[]{0,10,11,20};
                         * e.graphics.DrawLine(p, r.Left+1, r.Top + r.Height / 2, r.Right, r.Top + r.Height / 2);
                         */

                        e.Info.graphics.FillRectangle(b, r);
                        r.Width = e.Info.NodeRect.Width - 4;
                        if (r.Width == 0)
                        {
                            r.Width = 1;
                        }
                        e.Info.graphics.DrawRectangle(selected ? Pens.White : Pens.Black, r);
                        StringFormat sf = new StringFormat(StringFormatFlags.NoWrap);
                        sf.LineAlignment = StringAlignment.Center;
                        sf.Alignment     = StringAlignment.Center;
                        sf.Trimming      = StringTrimming.EllipsisCharacter;
                        e.Info.graphics.DrawString(String.Format("{0} %", pourcent), this.Font,
                                                   pourcent >= 55 || selected ? Brushes.White : Brushes.Black,
                                                   e.Info.NodeRect, sf);
                    }
                }
            }
        }
コード例 #13
0
ファイル: demoGrille.cs プロジェクト: pgourlain/treeview
 private void gtv_OnAfterCellPainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     if (e.Info.DisplayColumn == 0)
     {
         //dessine d'un bouton
         Rectangle       r     = new Rectangle(e.Info.ContentRect.Right, e.Info.ContentRect.Top, e.Info.ContentRect.Height, e.Info.ContentRect.Height);
         PushButtonState state = PushButtonState.Normal;
         if (r.Contains(e.Info.MousePosition))
         {
             if (e.Info.Buttons == MouseButtons.Left)
             {
                 state = PushButtonState.Pressed;
             }
             else
             {
                 state = PushButtonState.Hot;
             }
         }
         Genius.Controls.DrawingHelper.DrawButton(e.Info.graphics, r, e.Info.ClipRect, state);
         StringFormat sf = new StringFormat(StringFormatFlags.NoWrap);
         sf.Alignment     = StringAlignment.Center;
         sf.LineAlignment = StringAlignment.Center;
         e.Info.graphics.DrawString("...", this.gtv.Font, SystemBrushes.WindowText, r, sf);
     }
     else if (e.Info.DisplayColumn == 2)
     {
         CheckBoxState state = FChecked ? CheckBoxState.CheckedNormal : CheckBoxState.UncheckedNormal;
         Genius.Controls.DrawingHelper.DrawCheckBox(e.Info.graphics, e.Info.NodeRect, e.Info.ClipRect, state);
     }
 }
コード例 #14
0
ファイル: demoGrille.cs プロジェクト: pgourlain/treeview
 private void gtv_OnBeforeCellPainting(Genius.Controls.TreeView.GeniusTreeView Sender, Genius.Controls.TreeView.PaintNodeEventArgs e)
 {
     if (e.Info.DisplayColumn == 0)
     {
         e.Info.ContentRect.Width -= e.Info.ContentRect.Height;
     }
 }