private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            Graphics  g = e.Graphics;
            Rectangle r = e.CellBounds;

            using (Pen pen = new Pen(Color.SeaGreen, 0 /*1px width despite of page scale, dpi, page units*/))
            {
                pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center;
                // define border style
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;

                // decrease border rectangle height/width by pen's width for last row/column cell
                if (e.Row == (tableLayoutPanel1.RowCount - 1))
                {
                    r.Height -= 1;
                }

                if (e.Column == (tableLayoutPanel1.ColumnCount - 1))
                {
                    r.Width -= 1;
                }

                // use graphics mehtods to draw cell's border
                e.Graphics.DrawRectangle(pen, r);
            }
        }
Example #2
0
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if ((e.Column <= Dessin.initColumn + Dessin.rectangleWidth) && (e.Column > Dessin.initColumn) && (e.Row <= Dessin.initRow + Dessin.rectangleHeight) && (e.Row > Dessin.initRow))
     {
         e.Graphics.FillRectangle(Brushes.Red, e.CellBounds);
     }
 }
Example #3
0
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     using (var b = new SolidBrush(bgColors[e.Column, e.Row]))
     {
         e.Graphics.FillRectangle(b, e.CellBounds);
     }
 }
Example #4
0
 private void tableLayoutPanel_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row <= 5)
     {
         e.Graphics.FillRectangle(((e.Row % 2 == 0) ? evenBrush : oddBrush), e.CellBounds);
     }
 }
Example #5
0
        protected void SetBorder(TableLayoutCellPaintEventArgs e, Color color, ButtonBorderStyle borderStyle, int height, int width)
        {
            var rectangle = e.CellBounds;

            rectangle.Inflate(width, height);
            ControlPaint.DrawBorder(e.Graphics, rectangle, color, borderStyle);
        }
Example #6
0
 private void WsListPanelCellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Column == 0 && !_model.IsListValid)
     {
         e.Graphics.FillRectangle(new SolidBrush(Color.Red), e.CellBounds);
     }
 }
Example #7
0
    protected override void OnCellPaint(TableLayoutCellPaintEventArgs e)
    {
        base.OnCellPaint(e);

        Control c = this.GetControlFromPosition(e.Column, e.Row);

        if (c != null)
        {
            Graphics g = e.Graphics;

            g.DrawRectangle(
                Pens.Red,
                e.CellBounds.Location.X + 1,
                e.CellBounds.Location.Y + 1,
                e.CellBounds.Width - 2, e.CellBounds.Height - 2);

            g.FillRectangle(
                Brushes.Blue,
                e.CellBounds.Location.X + 1,
                e.CellBounds.Location.Y + 1,
                e.CellBounds.Width - 2,
                e.CellBounds.Height - 2);
        }
        ;
    }
        private void DynamicTable_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            Rectangle rectangle = e.CellBounds;
            rectangle.Inflate(-1, 1);

            ControlPaint.DrawBorder3D(e.Graphics, rectangle, Border3DStyle.RaisedInner, Border3DSide.All);
        }
Example #9
0
        private void TableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            // 重绘
            Pen pp = new Pen(Color.Gray);

            e.Graphics.DrawRectangle(pp, e.CellBounds.X, e.CellBounds.Y, e.CellBounds.X + e.CellBounds.Width - 1, e.CellBounds.Y + e.CellBounds.Height - 1);
        }
Example #10
0
        //--------------------------------------------------------

        //coloring cells of table layout panels
        private void TlpCustomerSearch_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            if (e.Column == 1)
            {
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(255, 48, 48, 48)), e.CellBounds);
            }
        }
 private void TableRemodel_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row % 2 == 1)
     {
         e.Graphics.DrawLine(Pens.Silver, e.CellBounds.X, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1);
     }
 }
Example #12
0
        private void TlpMain_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            Color color;

            if (e.Row.IsEvenNumber())
            {
                color = SystemColors.Window;
            }
            else
            {
                color = ColorHelpers.DarkerColor(SystemColors.Window, 0.02f);
            }

            using (Brush brush = new SolidBrush(color))
            {
                e.Graphics.FillRectangle(brush, e.CellBounds);
            }

            if (NewsManager != null && NewsManager.NewsItems != null && NewsManager.NewsItems.IsValidIndex(e.Row) && NewsManager.NewsItems[e.Row].IsUnread && e.Column == 0)
            {
                e.Graphics.FillRectangle(Brushes.LimeGreen, new Rectangle(e.CellBounds.X, e.CellBounds.Y, 5, e.CellBounds.Height));
            }

            using (Pen pen = new Pen(ProfessionalColors.SeparatorDark))
            {
                e.Graphics.DrawLine(pen, new Point(e.CellBounds.X, e.CellBounds.Bottom - 1), new Point(e.CellBounds.Right - 1, e.CellBounds.Bottom - 1));
            }
        }
Example #13
0
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row == this.SelectedRow && e.Column == 1)
     {
         e.Graphics.FillRectangle(new SolidBrush(SystemColors.Highlight), e.CellBounds);
     }
 }
Example #14
0
        private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            var panel = sender as TableLayoutPanel;

            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            var rectangle = e.CellBounds;

            using (var pen = new Pen(Color.FromArgb(30, 120, 255), 1))
            {
                pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center;
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;

                if (e.Row == (panel.RowCount - 1))
                {
                    rectangle.Height -= 1;
                }

                if (e.Column == (panel.ColumnCount - 1))
                {
                    rectangle.Width -= 1;
                }

                e.Graphics.DrawRectangle(pen, rectangle);
            }
        }
Example #15
0
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Column == 1)
     {
         e.Graphics.FillRectangle(Brushes.Transparent, e.CellBounds);
     }
 }
Example #16
0
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (activeRow == e.Row && activeColumn == e.Column)
     {
         e.Graphics.DrawRectangle(pen, e.CellBounds.X, e.CellBounds.Y, e.CellBounds.Width, e.CellBounds.Height);
     }
 }
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row == 0)
     {
         e.Graphics.FillRectangle(new SolidBrush(Color.MediumSeaGreen), e.CellBounds);
     }
 }
 private void pnlLayout_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row == 0)
     {
         e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(255, 44, 44, 44)), e.CellBounds);
     }
 }
Example #19
0
        private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            //var g = this.tableLayoutPanel1.CreateGraphics();
            //g.DrawRectangle(new Pen(Color.Red), 50, 50, 50, 50);
            var offset = 3;
            // 单元格重绘 
            Pen pen   = new Pen(Color.Red);
            var bursh = new SolidBrush(Color.Blue);

            //e.Graphics.DrawRectangle(pp, e.CellBounds.X + offset, e.CellBounds.Y + offset, e.CellBounds.X + e.CellBounds.Width - offset, e.CellBounds.Y + e.CellBounds.Height - offset);
            e.Graphics.DrawRectangle(pen, e.CellBounds.X + offset, e.CellBounds.Y + offset, e.CellBounds.Width - 2 * offset, e.CellBounds.Height - 2 * offset);
            e.Graphics.FillRectangle(bursh, e.CellBounds.X + 2 * offset, e.CellBounds.Y + 2 * offset, e.CellBounds.Width - 4 * offset, e.CellBounds.Height - 4 * offset);

            System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
            messageBoxCS.AppendFormat("{0} = {1}", "CellBounds", e.CellBounds);
            messageBoxCS.AppendLine();
            messageBoxCS.AppendFormat("{0} = {1}", "Row", e.Row);
            messageBoxCS.AppendLine();
            messageBoxCS.AppendFormat("{0} = {1}", "Column", e.Column);
            messageBoxCS.AppendLine();
            messageBoxCS.AppendFormat("{0} = {1}", "ClipRectangle", e.ClipRectangle);
            messageBoxCS.AppendLine();
            messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics);
            messageBoxCS.AppendLine();
            //MessageBox.Show(messageBoxCS.ToString(), "CellPaint Event");
            label1.Text = messageBoxCS.ToString();
            label1.Text = DateTime.Now.ToString();
        }
        private void m_tableLayout_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            if (e.Row == 0)
            {
                var brush = new SolidBrush(SystemColors.ActiveBorder);
                e.Graphics.FillRectangle(brush, e.CellBounds);
            }

            var r = e.CellBounds;

            using (var pen = new Pen(glyssenColorPalette.GetColor(GlyssenColors.ForeColor), 0))
            {
                pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center;
                // define border style
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;

                // decrease border rectangle height/width by pen's width for last row/column cell
                if (e.Row == (m_tableLayout.RowCount - 1))
                {
                    r.Height -= 1;
                }

                if (e.Column == (m_tableLayout.ColumnCount - 1))
                {
                    r.Width -= 1;
                }

                // use graphics methods to draw cell's border
                e.Graphics.DrawRectangle(pen, r);
            }
        }
Example #21
0
 private void PixelDisp_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     using (SolidBrush sb = new SolidBrush(backCol[e.Column, e.Row]))
     {
         e.Graphics.FillRectangle(sb, e.CellBounds);
     }
 }
        private void tlpWynik_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            Rectangle rect = e.CellBounds;

            rect.Width  -= 2;
            rect.Height -= 2;
            e.Graphics.DrawRectangle(new Pen(Color.Black), rect);

            /*if (e.Row < tlpWynik.RowCount - 1 && e.Column < tlpWynik.ColumnCount - 1)
             * {
             *  e.Graphics.DrawRectangle(new Pen(Color.Black), e.CellBounds);
             * }
             * else
             * {
             *  if (e.Row == tlpWynik.RowCount - 1)
             *  {
             *      Rectangle rct = e.CellBounds;
             *      rct.Height--;
             *      e.Graphics.DrawRectangle(new Pen(Color.Black), rct);
             *  }
             *  if (e.Column == tlpWynik.ColumnCount - 1)
             *  {
             *      Rectangle rct = e.CellBounds;
             *      rct.Width--;
             *      e.Graphics.DrawRectangle(new Pen(Color.Black), rct);
             *  }
             * }*/
        }
Example #23
0
        private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            var rectangle = e.CellBounds;

            rectangle.Inflate(-1, -1);
            ControlPaint.DrawBorder(e.Graphics, rectangle, Color.Gray, ButtonBorderStyle.Dotted); //
        }
Example #24
0
		private void TableParameterMain_CellPaint( object sender, TableLayoutCellPaintEventArgs e ) {
			e.Graphics.DrawLine( Pens.Silver, e.CellBounds.X, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1 );
			/*/
			if ( e.Column == 0 )
				e.Graphics.DrawLine( Pens.Silver, e.CellBounds.Right - 1, e.CellBounds.Y, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1 );
			//*/
		}
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row == 0)
     {
         e.Graphics.FillRectangle(Brushes.DarkGray, e.CellBounds);
     }
 }
Example #26
0
 private void TblLayoutCSLD_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (TblLayoutCSLDCellPaint != null)
     {
         TblLayoutCSLDCellPaint(sender, e);
     }
 }
Example #27
0
 private void tblCustomer_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Column == 0)
     {
         e.Graphics.FillRectangle(Brushes.LightGray, e.CellBounds);
     }
 }
Example #28
0
        private void TlpMain_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            Color color;

            if (e.Row.IsEvenNumber())
            {
                color = Color.FromArgb(250, 250, 250);
            }
            else
            {
                color = Color.FromArgb(247, 247, 247);
            }

            using (Brush brush = new SolidBrush(color))
            {
                e.Graphics.FillRectangle(brush, e.CellBounds);
            }

            if (NewsManager != null && NewsManager.NewsItems != null & NewsManager.NewsItems.IsValidIndex(e.Row) &&
                NewsManager.NewsItems[e.Row].IsUnread && e.Column == 0)
            {
                e.Graphics.FillRectangle(Brushes.LimeGreen, new Rectangle(e.CellBounds.X, e.CellBounds.Y, 5, e.CellBounds.Height));
            }

            e.Graphics.DrawLine(Pens.LightGray, new Point(e.CellBounds.X, e.CellBounds.Bottom - 1), new Point(e.CellBounds.Right - 1, e.CellBounds.Bottom - 1));
        }
Example #29
0
 void levelTable2_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row == rowHighlight2)
     {
         e.Graphics.DrawRectangle(new Pen(Color.Red, 3), e.CellBounds);
     }
 }
Example #30
0
 private void Grid_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Column > -10 && e.Row > -2)
     {
         e.Graphics.DrawRectangle(new Pen(Color.Black), e.CellBounds);
     }
 }