コード例 #1
0
ファイル: GridCellTable.cs プロジェクト: fredatgithub/DtPad
 public GridCellGroup()
 {
     Table = new GridCellTable(this);
 }
コード例 #2
0
 private void DrawGridTable(Graphics g, RectangleF clipRect, int X, int Y, GridCellTable table,
     int pixelWidth, int pixelHeight, bool isSelected)
 {
     Pen pen = new Pen(Color.Silver);
     int left = X;
     int bottom = Y + pixelHeight;
     for (int i = 0; i < table.Width - 1; i++)
     {
         left += table.ColumnsWidth[i];
         g.DrawLine(pen, left, Y, left, bottom);
     }
     int top = Y;
     int right = X + pixelWidth;
     for (int i = 0; i < table.Height - 1; i++)
     {
         top += table.RowHeight[i];
         g.DrawLine(pen, X, top, right, top);
     }
     top = Y;
     for (int s = 0; s < table.Height; s++)
     {
         left = X;
         int H = table.RowHeight[s];
         if (clipRect.Top < top + H && top <= clipRect.Bottom)
             for (int k = 0; k < table.Width; k++)
             {
                 int W = table.ColumnsWidth[k];
                 if (clipRect.Left < left + W && left <= clipRect.Right)
                 {
                     GridCell cell = table[k, s];
                     bool cellSelected = isSelected ||
                         (table[k, 0] is GridColumnLabel && table[k, 0] == _focusedCell) ||
                             (table[0, s] is GridRowLabel && table[0, s] == _focusedCell);
                     if (cell.IsGroup)
                     {
                         GridCellGroup groupCell = (GridCellGroup)cell;
                         if (groupCell.Overlaped)
                             DrawGridTable(g, clipRect, left, top, groupCell.Table, W, H, cellSelected);
                         else
                             DrawGroupCell(g, clipRect, left, top, groupCell, W, H, cellSelected);
                     }
                     else
                         DrawCell(g, left, top, cell, W, H, cellSelected);
                 }
                 left += W;
             }
         top += H;
     }
     if (top < Y + pixelHeight)
         g.DrawLine(pen, X, top, X + pixelWidth, top);
 }
コード例 #3
0
 private void GetRowNumWidth(GridCellTable table, Graphics g)
 {
     Font font = new Font(Font, FontStyle.Bold);
     int width = (int)g.MeasureString(table.Height.ToString() + "0", font).Width + 3;
     if (width > _rowNumWidth)
         _rowNumWidth = width;
     for (int k = 0; k < table.Width; k++)
         for (int s = 0; s < table.Height; s++)
             if (table[k, s].IsGroup)
             {
                 GridCellGroup cell = (GridCellGroup)table[k, s];
                 if (cell.TableView)
                 {
                     width = (int)g.MeasureString(cell.Table.Height.ToString() + "0", font).Width + 3;
                     if (width > _rowNumWidth)
                         _rowNumWidth = width;
                 }
                 GetRowNumWidth(cell.Table, g);
             }
 }
コード例 #4
0
 public GridCellGroup()
 {
     Table = new GridCellTable(this);
 }