예제 #1
0
        private void gridViewAnalyse_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e)
        {
            i++;
            int gridRowHeaderHeight;

            if (e.Column == null)
            {
                return;
            }

            RowHeadFlag rhf = e.Column.Tag as RowHeadFlag;

            StringFormat sf = new StringFormat();

            sf.Alignment     = StringAlignment.Center;
            sf.LineAlignment = StringAlignment.Center;
            Graphics g = e.Graphics;

            if (rhf != null)
            {
                gridRowHeaderHeight = e.Bounds.Size.Height / 2;
                Rectangle rect1 = new Rectangle(e.Bounds.Location, new System.Drawing.Size(e.Bounds.Size.Width, gridRowHeaderHeight));
                Rectangle rect2 = new Rectangle(new Point(e.Bounds.Location.X, e.Bounds.Location.Y + gridRowHeaderHeight),
                                                new System.Drawing.Size(e.Bounds.Size.Width, gridRowHeaderHeight));

                m_DrawHeadRectangle.AddBound(rhf, rect1);

                Rectangle rect = new Rectangle(m_DrawHeadRectangle.Bound.Location.X, m_DrawHeadRectangle.Bound.Location.Y, m_DrawHeadRectangle.Bound.Width - 1, m_DrawHeadRectangle.Bound.Height - 1);
                g.FillRectangle(new SolidBrush(Color.FromArgb(235, 236, 239)), rect);
                g.DrawRectangle(SystemPens.ControlDark, rect);
                g.DrawString(rhf.HeaderName, this.Font, Brushes.Black, rect, sf);

                rect = new Rectangle(rect2.Location.X, rect2.Location.Y, rect2.Width - 1, rect2.Height - 1);
                g.FillRectangle(new SolidBrush(Color.FromArgb(235, 236, 239)), rect);
                g.DrawRectangle(SystemPens.ControlDark, rect);
                g.DrawString(e.Info.Caption, this.Font, Brushes.Black, rect, sf);
            }
            else
            {
                Rectangle rect = new Rectangle(e.Bounds.Location.X, e.Bounds.Location.Y, e.Bounds.Width - 1, e.Bounds.Height - 1);
                g.FillRectangle(new SolidBrush(Color.FromArgb(235, 236, 239)), rect);
                g.DrawRectangle(SystemPens.ControlDark, rect);
                g.DrawString(e.Info.Caption, this.Font, Brushes.Black, rect, sf);
            }

            if (e.Column.VisibleIndex == GetGridControlVisibleColumnsCount())
            {
                m_DrawHeadRectangle = new DrawHeadRectangle2();
            }

            e.Handled = true;
        }
예제 #2
0
        private void ChangeDataTableForExportting()
        {
            DataTable dt = gridControlAnalyse.DataSource as DataTable;

            foreach (GridColumn gc in gridViewAnalyse.Columns)
            {
                RowHeadFlag rhf = gc.Tag as RowHeadFlag;
                if (rhf != null)
                {
                    gc.Caption = rhf.HeaderName + "|" + gc.Caption;
                }
            }
        }
예제 #3
0
        private void ChangeDataTableForExportted()
        {
            DataTable dt = gridControlAnalyse.DataSource as DataTable;

            foreach (GridColumn gc in gridViewAnalyse.Columns)
            {
                RowHeadFlag rhf = gc.Tag as RowHeadFlag;
                if (rhf != null)
                {
                    if (gc.Caption.IndexOf(rhf.HeaderName) >= 0)
                    {
                        gc.Caption = gc.Caption.Substring(rhf.HeaderName.Length + 1);
                    }
                }
            }
        }
예제 #4
0
 public void AddBound(RowHeadFlag flag, Rectangle rect)
 {
     if (CurrentRowHeadFlag == null)
     {
         Bound = rect;
         CurrentRowHeadFlag = flag;
     }
     else
     {
         if (CurrentRowHeadFlag.Equals(flag))
         {
             Bound = new Rectangle(Bound.Location, new Size(Bound.Width + rect.Width, Bound.Height));
         }
         else
         {
             Bound = rect;
             CurrentRowHeadFlag = flag;
         }
     }
 }
예제 #5
0
 public bool Equals(RowHeadFlag flag)
 {
     return(GroupID.Equals(flag.GroupID) && HeaderName.Equals(flag.HeaderName));
 }