Exemplo n.º 1
0
 private void tlpInvoice_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row == 1 || e.Row == tlpInvoice.Controls.Count - 1)
     {
         e.Graphics.DrawLine(Pens.Black, e.CellBounds.Location, new Point(e.CellBounds.Right, e.CellBounds.Top));
     }
 }
Exemplo n.º 2
0
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if ((e.Column + e.Row) % 2 == 1)
         e.Graphics.FillRectangle(Brushes.Black, e.CellBounds);
     else
         e.Graphics.FillRectangle(Brushes.White, e.CellBounds);
 }
Exemplo n.º 3
0
        void OnCellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            var c = (NoiseControl)tableLayoutPanel1.GetControlFromPosition(e.Column, e.Row);

            if (c == null)
                return;

            int column = tableLayoutPanel1.GetColumn(c);

            if (e.Column != column)
                return;

            int xSpan = tableLayoutPanel1.GetColumnSpan(c);

            Graphics g = e.Graphics;

            int x1 = e.CellBounds.X;
            int y1 = e.CellBounds.Y;
            int x2 = e.CellBounds.X + e.CellBounds.Width * xSpan;
            int y2 = e.CellBounds.Y + e.CellBounds.Height;

            g.DrawLine(Pens.Red, x1, y1, x1, y2);
            g.DrawLine(Pens.Red, x2, y1, x2, y2);
            if (c.Module.SourceModuleCount == 0)
                g.DrawLine(Pens.Red, x1, y1, x2, y1);
        }
Exemplo n.º 4
0
        protected virtual void OnCellPaint(TableLayoutCellPaintEventArgs e)
        {
            TableLayoutCellPaintEventHandler eh = (TableLayoutCellPaintEventHandler)(Events [CellPaintEvent]);

            if (eh != null)
            {
                eh(this, e);
            }
        }
        protected virtual void OnCellPaint(TableLayoutCellPaintEventArgs e)
        {
            TableLayoutCellPaintEventHandler handler = (TableLayoutCellPaintEventHandler)base.Events[EventCellPaint];

            if (handler != null)
            {
                handler(this, e);
            }
        }
 private void TableLayoutPanelContent_CellPaint(System.Object sender, System.Windows.Forms.TableLayoutCellPaintEventArgs e)
 {
     if (_drawGradient && e.Row == 0 && e.Column == 1)
     {
         Rectangle bounds = new Rectangle(0, 0, TableLayoutPanel.Width, e.CellBounds.Height);
         using (var b = new LinearGradientBrush(bounds, _gradientBegin, _gradientEnd, LinearGradientMode.Horizontal))
         {
             e.Graphics.FillRectangle(b, bounds);
         }
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Mise en forme du tableau 
        /// </summary>
        private void tablePanel_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            // Coloriage de la première colonne en 'jaune info'
            if (e.Column == 0)
                e.Graphics.FillRectangle(new SolidBrush(SystemColors.Info), e.CellBounds);

            // Ajout d'une ligne double en bas de la première ligne
            if (e.Row == 0)
                e.Graphics.DrawLine(
                    new Pen(Color.Black, 2),
                    new Point(e.CellBounds.Left,e.CellBounds.Bottom-1),    // -1 pour que l'épaisseur de 2px tienne
                    new Point(e.CellBounds.Right, e.CellBounds.Bottom - 1) // dans la ligne
               );
        }
Exemplo n.º 8
0
        private void blackTeamPanel_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            if (pawnChangable && currentState.getMyTeam() == (int)team.black)
            {
                blackTeamPanel.SuspendLayout();

                foreach (Piece piece in gameboard.getDead((int)team.black))
                {
                    double index = gameboard.getDead((int)team.black).IndexOf(piece);
                    int row = (int)Math.Floor(index / 2);
                    int column = (int)index % 2;

                    if (e.Row == row && e.Column == column)
                    {
                        Rectangle r = e.CellBounds;
                        r.Inflate(-1, -1);
                        ControlPaint.DrawBorder(e.Graphics, r, Color.Black, 2, ButtonBorderStyle.Solid, Color.Black, 2, ButtonBorderStyle.Solid, Color.Black, 2, ButtonBorderStyle.Solid, Color.Black, 2, ButtonBorderStyle.Solid);
                    }
                }

                blackTeamPanel.ResumeLayout();
            }
        }
Exemplo n.º 9
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);
            };
        }
Exemplo n.º 10
0
        private void tableLayoutPanel_content_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            /*
            Brush brush = new SolidBrush(Color.Red);
            Rectangle rect = Rectangle.Inflate(e.CellBounds, -1, -1);
            e.Graphics.FillRectangle(brush, rect);
             * */
            if (this.m_nInSuspend > 0)
                return; // 防止闪动

            // Rectangle rect = Rectangle.Inflate(e.CellBounds, -1, -1);
            Rectangle rect = e.CellBounds;
            Pen pen = new Pen(Color.FromArgb(200,200,200));
            e.Graphics.DrawRectangle(pen, rect);
        }
Exemplo n.º 11
0
        private void SplitsTableCellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {

            int leftX = e.CellBounds.X;
            int rightX = e.CellBounds.X + e.CellBounds.Width;
            int topY = e.CellBounds.Y;
            int bottomY = e.CellBounds.Y + e.CellBounds.Height;

            if (SHOW_FINAL_SPLIT && Scrollable)
            {
                if (e.Row == GetNumSplitsWithoutFinal())
                {
                    //bottom line
                    e.Graphics.DrawLine(new Pen(Color.Gray), leftX, bottomY, rightX, bottomY);

                    //top line
                    if (Run != null)
                    {
                        if (Run.CurrentSplitIndex < Run.Count - NUM_UPCOMING_SPLITS - 2)
                            e.Graphics.DrawLine(new Pen(Color.Gray), leftX, topY, rightX, topY);
                    }
                    else
                        e.Graphics.DrawLine(new Pen(Color.Gray), leftX, topY, rightX, topY);
                }
            }

            if (Run != null)
            {
                if (!Run.LastSplitDone())
                {
                    for (int i = 0; i < Splits.Length; i++)
                    {
                        if (Run.GetCurrentSplit() == Splits[i].Split && e.Row == i)
                        {
                            e.Graphics.FillRectangle(new SolidBrush(CURRENT_SPLIT_BACKGROUND_COLOR), e.CellBounds);
                        }
                    }
                }
            }
        }
Exemplo n.º 12
0
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row == 1 && e.Column == 0)
     {
         e.Graphics.FillRectangle(new SolidBrush(Color.LightGray), e.CellBounds);
     }
     if (e.Row == 1 && e.Column == 1)
     {
         e.Graphics.FillRectangle(new SolidBrush(Color.LightGray), e.CellBounds);
     }
 }
Exemplo n.º 13
0
 /// <summary>
 /// Handles various table layout panels' cell paint events for hover background.
 /// </summary>
 private void onTblLayoutCellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     // No hover: all backgrounds default.
     if (hoverIx == -1) return;
     Label lblHover = lblColl[hoverIx];
     object hoverTable;
     int rowIx = -1;
     if (lblHover == lblFullFormatted || lblHover == lblFullCedict)
     {
         hoverTable = tblFull;
         rowIx = lblHover == lblFullFormatted ? 1 : 2;
     }
     else if (lblHover == lblHanzi1 || lblHover == lblHanzi2 || lblHover == lblPinyin)
     {
         hoverTable = tblZho;
         if (lblHover == lblHanzi1) rowIx = 1;
         else if (lblHover == lblHanzi2) rowIx = 2;
         else rowIx = lblHanzi2 == null ? 2 : 3;
     }
     else
     {
         hoverTable = tblSense;
         rowIx = 1;
     }
     if (sender == hoverTable && e.Row == rowIx)
     {
         using (Brush b = new SolidBrush(ZenParams.CtxtMenuHoverColor))
         {
             Rectangle rect = e.CellBounds;
             rect.Width = e.ClipRectangle.Width;
             e.Graphics.FillRectangle(b, rect);
             rect.X = 0;
             e.Graphics.FillRectangle(b, rect);
         }
     }
 }
Exemplo n.º 14
0
        private void tlp_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            var panel = sender as TableLayoutPanel;
            Rectangle rect = e.CellBounds;
            Graphics g = e.Graphics;
            int column = e.Column, row = e.Row;

            if ((column == 0 && (row < 8 && row > 0 || row == 11)) || (row == 0 && column < 12 && column > 0))
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 250, 150, 70)), rect);
            else if ((column == 0 && row == 8) || (row == 0 && (column == 12 || column == 13)))
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 190, 80, 80)), rect);
            else if (row > 0 && row < 8 && column > 0 && column < 12)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 250, 230, 220)), rect);
            else if (column > 11 && row > 0 && row < 8)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 240, 220, 220)), rect);
            else if (row == 8 && column > 0 && column < 12)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 220, 150, 150)), rect);
            else if (row == 9 && column == 0)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 130, 100, 160)), rect);
            else if (row == 9 && column > 0 && column < 12)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 180, 160, 200)), rect);
            else if (row == 10 && column == 0)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 160, 190, 90)), rect);
            else if (row == 10 && column > 0 && column < 12)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 195, 215, 155)), rect);
            else if (row == 11 && column > 0 && column < 12)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 250, 190, 145)), rect);
            else if (row == 12 && column == 0)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 75, 170, 200)), rect);
            else if (row == 12 && column > 0 && column < 12)
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, 145, 205, 220)), rect);

            using (var pen = new Pen(Color.Black, 1))
            {
                if (row == (panel.RowCount - 1))
                    rect.Height -= 1;
                if (column == (panel.ColumnCount - 1))
                    rect.Width -= 1;

                if ((row != 0 || column != 0) && (column < 12 || row < 8))
                    g.DrawRectangle(pen, rect);
            }
        }
		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 );
			//*/
		}
Exemplo n.º 16
0
		protected virtual void OnCellPaint (TableLayoutCellPaintEventArgs e)
		{
			TableLayoutCellPaintEventHandler eh = (TableLayoutCellPaintEventHandler)(Events [CellPaintEvent]);
			if (eh != null)
				eh (this, e);
		}
Exemplo n.º 17
0
		private void TableEnemyCandidateMember_CellPaint( object sender, TableLayoutCellPaintEventArgs e ) {

			if ( _enemyFleetCandidate == null || _enemyFleetCandidateIndex + e.Column >= _enemyFleetCandidate.Count )
				return;


			e.Graphics.DrawLine( Pens.Silver, e.CellBounds.Right - 1, e.CellBounds.Top, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1 );

			if ( e.Row == 5 || e.Row == 7 ) {
				e.Graphics.DrawLine( Pens.Silver, e.CellBounds.X, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1 );
			}
		}
Exemplo n.º 18
0
		public void TestTableLayoutCellPaintEventArgs()
		{
			Rectangle bounds = new Rectangle(0, 0, 100, 200);
			Rectangle clip = new Rectangle(50, 50, 50, 50);
			int col = 54;
			int row = 77;
			Bitmap b = new Bitmap(100, 100);
			Graphics g = Graphics.FromImage(b);
			
			TableLayoutCellPaintEventArgs e = new TableLayoutCellPaintEventArgs(g, clip, bounds, col, row);
			
			Assert.AreEqual(bounds, e.CellBounds, "A1");
			Assert.AreEqual(col, e.Column, "A2");
			Assert.AreEqual(row, e.Row, "A3");
			Assert.AreEqual(g, e.Graphics, "A4");
			Assert.AreEqual(clip, e.ClipRectangle, "A5");
		}
Exemplo n.º 19
0
 private void setStatus_CellPaint(int court, TableLayoutCellPaintEventArgs e)
 {
     foreach (DataRow row in reserve_data.Rows)
     {
         int id = row.Field<int>(0);
         int court_id = row.Field<int>(2);
         string date = row.Field<DateTime>(4).ToString("yyyy-MM-dd");
         int start_time = int.Parse(DateTime.Parse(row.Field<TimeSpan>(5).ToString()).ToString("HH"));
         int end_time = int.Parse(DateTime.Parse(row.Field<TimeSpan>(6).ToString()).ToString("HH"));
         int status = row.Field<int>(8);
         if (date.Equals(dtpDate.Text))
         {
             if (court == court_id)
             {
                 while (start_time < end_time)
                 {
                     if (start_time == 06)
                     {
                         if (e.Row == 0 && e.Column == 0)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 07)
                     {
                         if (e.Row == 0 && e.Column == 1)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 08)
                     {
                         if (e.Row == 0 && e.Column == 2)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 09)
                     {
                         if (e.Row == 0 && e.Column == 3)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 10)
                     {
                         if (e.Row == 0 && e.Column == 4)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 11)
                     {
                         if (e.Row == 0 && e.Column == 5)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 12)
                     {
                         if (e.Row == 1 && e.Column == 0)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 13)
                     {
                         if (e.Row == 1 && e.Column == 1)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 14)
                     {
                         if (e.Row == 1 && e.Column == 2)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 15)
                     {
                         if (e.Row == 1 && e.Column == 3)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 16)
                     {
                         if (e.Row == 1 && e.Column == 4)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 17)
                     {
                         if (e.Row == 1 && e.Column == 5)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 18)
                     {
                         if (e.Row == 2 && e.Column == 0)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 19)
                     {
                         if (e.Row == 2 && e.Column == 1)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 20)
                     {
                         if (e.Row == 2 && e.Column == 2)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 21)
                     {
                         if (e.Row == 2 && e.Column == 3)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 22)
                     {
                         if (e.Row == 2 && e.Column == 4)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     if (start_time == 23)
                     {
                         if (e.Row == 2 && e.Column == 5)
                         {
                             if (status == 3) { e.Graphics.FillRectangle(Brushes.Gold, e.CellBounds); }
                             if (status == 2) { e.Graphics.FillRectangle(Brushes.Firebrick, e.CellBounds); }
                             if (status == 1) { e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.CellBounds); }
                         }
                     }
                     start_time++;
                 }
             }
         }
     }
 }
Exemplo n.º 20
0
 protected virtual void OnCellPaint(TableLayoutCellPaintEventArgs e)
 {
     throw null;
 }
Exemplo n.º 21
0
 private void ColorCell(TableLayoutCellPaintEventArgs e, Color c)
 {
     Graphics g = e.Graphics;
     Rectangle r = e.CellBounds;
     g.FillRectangle(new SolidBrush(c), r);
 }
Exemplo n.º 22
0
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Column == 0 || e.Row == 0)
     {
         ColorCell(e, Color.FromKnownColor(KnownColor.LightSteelBlue));
     }
 }
Exemplo n.º 23
0
        private void tableLayout_Layers_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            Color cr = Color.FromName("blue");
            SolidBrush sb = new System.Drawing.SolidBrush(cr);

            if (e.Column == z.WybranyLayers+1)
                e.Graphics.FillRectangle(sb, e.CellBounds);

            checkBox_Ghost0.BackColor = Color.FromName("control");
            checkBox_Ghost1.BackColor = Color.FromName("control");
            checkBox_Ghost2.BackColor = Color.FromName("control");
            checkBox_Ghost3.BackColor = Color.FromName("control");
            checkBox_GhostSecure0.BackColor = Color.FromName("control");
            checkBox_GhostSecure1.BackColor = Color.FromName("control");
            checkBox_GhostSecure2.BackColor = Color.FromName("control");
            checkBox_GhostSecure3.BackColor = Color.FromName("control");
            label_Ghost0.BackColor = Color.FromName("control");
            label_Ghost1.BackColor = Color.FromName("control");
            label_Ghost2.BackColor = Color.FromName("control");
            label_Ghost3.BackColor = Color.FromName("control");

            if (z.WybranyLayers == 0)
                label_Ghost0.BackColor = checkBox_GhostSecure0.BackColor = checkBox_Ghost0.BackColor = cr;
            if (z.WybranyLayers == 1)
                label_Ghost1.BackColor = checkBox_GhostSecure1.BackColor = checkBox_Ghost1.BackColor = cr;
            if (z.WybranyLayers == 2)
                label_Ghost2.BackColor = checkBox_GhostSecure2.BackColor = checkBox_Ghost2.BackColor = cr;
            if (z.WybranyLayers == 3)
                label_Ghost3.BackColor = checkBox_GhostSecure3.BackColor = checkBox_Ghost3.BackColor = cr;
        }
Exemplo n.º 24
0
        private void tableLayoutPanel4_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            Color cr = Color.FromName("blue");
            SolidBrush sb = new System.Drawing.SolidBrush(cr);

            if (e.Column == z.WybranaFrame)
                e.Graphics.FillRectangle(sb, e.CellBounds);

            label_frame0.BackColor = Color.FromName("control");
            label_frame1.BackColor = Color.FromName("control");
            label_frame2.BackColor = Color.FromName("control");
            label_frame3.BackColor = Color.FromName("control");
            label_frame4.BackColor = Color.FromName("control");
            label_frame5.BackColor = Color.FromName("control");

            if (z.WybranaFrame  == 0) label_frame0.BackColor = cr;
            if (z.WybranaFrame == 1) label_frame1.BackColor = cr;
            if (z.WybranaFrame == 2) label_frame2.BackColor = cr;
            if (z.WybranaFrame == 3) label_frame3.BackColor = cr;
            if (z.WybranaFrame  == 4) label_frame4.BackColor = cr;
            if (z.WybranaFrame == 5) label_frame5.BackColor = cr;

            label_frame0.Refresh();
            label_frame1.Refresh();
            label_frame2.Refresh();
            label_frame3.Refresh();
            label_frame4.Refresh();
            label_frame5.Refresh();
        }
Exemplo n.º 25
0
 private void tlpCourt9_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     setStatus_CellPaint(9, e);
 }
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);
            int cellBorderWidth = this.CellBorderWidth;

            TableLayout.ContainerInfo       containerInfo   = TableLayout.GetContainerInfo(this);
            TableLayout.Strip[]             columns         = containerInfo.Columns;
            TableLayout.Strip[]             rows            = containerInfo.Rows;
            TableLayoutPanelCellBorderStyle cellBorderStyle = this.CellBorderStyle;

            if ((columns != null) && (rows != null))
            {
                int       num6;
                int       length           = columns.Length;
                int       num3             = rows.Length;
                int       num4             = 0;
                int       num5             = 0;
                Graphics  g                = e.Graphics;
                Rectangle displayRectangle = this.DisplayRectangle;
                Rectangle clipRectangle    = e.ClipRectangle;
                bool      flag             = this.RightToLeft == RightToLeft.Yes;
                if (flag)
                {
                    num6 = displayRectangle.Right - (cellBorderWidth / 2);
                }
                else
                {
                    num6 = displayRectangle.X + (cellBorderWidth / 2);
                }
                for (int i = 0; i < length; i++)
                {
                    int y = displayRectangle.Y + (cellBorderWidth / 2);
                    if (flag)
                    {
                        num6 -= columns[i].MinSize;
                    }
                    for (int j = 0; j < num3; j++)
                    {
                        Rectangle bound = new Rectangle(num6, y, columns[i].MinSize, rows[j].MinSize);
                        Rectangle rect  = new Rectangle(bound.X + ((cellBorderWidth + 1) / 2), bound.Y + ((cellBorderWidth + 1) / 2), bound.Width - ((cellBorderWidth + 1) / 2), bound.Height - ((cellBorderWidth + 1) / 2));
                        if (clipRectangle.IntersectsWith(rect))
                        {
                            using (TableLayoutCellPaintEventArgs args = new TableLayoutCellPaintEventArgs(g, clipRectangle, rect, i, j))
                            {
                                this.OnCellPaint(args);
                            }
                            ControlPaint.PaintTableCellBorder(cellBorderStyle, g, bound);
                        }
                        y += rows[j].MinSize;
                        if (i == 0)
                        {
                            num5 += rows[j].MinSize;
                        }
                    }
                    if (!flag)
                    {
                        num6 += columns[i].MinSize;
                    }
                    num4 += columns[i].MinSize;
                }
                if ((base.HScroll || base.VScroll) || (cellBorderStyle == TableLayoutPanelCellBorderStyle.None))
                {
                    ControlPaint.PaintTableControlBorder(cellBorderStyle, g, displayRectangle);
                }
                else
                {
                    Rectangle rectangle5 = new Rectangle((cellBorderWidth / 2) + displayRectangle.X, (cellBorderWidth / 2) + displayRectangle.Y, displayRectangle.Width - cellBorderWidth, displayRectangle.Height - cellBorderWidth);
                    switch (cellBorderStyle)
                    {
                    case TableLayoutPanelCellBorderStyle.Inset:
                        g.DrawLine(SystemPens.ControlDark, rectangle5.Right, rectangle5.Y, rectangle5.Right, rectangle5.Bottom);
                        g.DrawLine(SystemPens.ControlDark, rectangle5.X, (rectangle5.Y + rectangle5.Height) - 1, (rectangle5.X + rectangle5.Width) - 1, (rectangle5.Y + rectangle5.Height) - 1);
                        break;

                    case TableLayoutPanelCellBorderStyle.Outset:
                    {
                        using (Pen pen = new Pen(SystemColors.Window))
                        {
                            g.DrawLine(pen, (rectangle5.X + rectangle5.Width) - 1, rectangle5.Y, (rectangle5.X + rectangle5.Width) - 1, (rectangle5.Y + rectangle5.Height) - 1);
                            g.DrawLine(pen, rectangle5.X, (rectangle5.Y + rectangle5.Height) - 1, (rectangle5.X + rectangle5.Width) - 1, (rectangle5.Y + rectangle5.Height) - 1);
                            break;
                        }
                    }

                    default:
                        ControlPaint.PaintTableCellBorder(cellBorderStyle, g, rectangle5);
                        break;
                    }
                    ControlPaint.PaintTableControlBorder(cellBorderStyle, g, displayRectangle);
                }
            }
        }
Exemplo n.º 27
0
        private void TpMainCellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {
            if (e.Row != 0 || e.Column != 0)
                return;

            int blockWidth = (e.CellBounds.Width - (BlockCount - 1) * 2)/BlockCount;

            using (var emptyBrush = new SolidBrush(BackColor))
            {
                for (int i = 0; i < BlockCount; i++)
                {
                    var rect = new Rectangle(e.CellBounds.Left + (blockWidth + 2)*i, e.CellBounds.Top, blockWidth, e.CellBounds.Height);
                    e.Graphics.FillRectangle(i < _currentBlockCount ? _currentBrush : emptyBrush, rect);
                    e.Graphics.DrawRectangle(_borderPen, rect);
                }
            }
        }
 protected virtual void OnCellPaint(TableLayoutCellPaintEventArgs e)
 {
     TableLayoutCellPaintEventHandler handler = (TableLayoutCellPaintEventHandler) base.Events[EventCellPaint];
     if (handler != null)
     {
         handler(this, e);
     }
 }
Exemplo n.º 29
0
        private void tableLayoutPanel2_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {

        }
Exemplo n.º 30
0
 private void TableTop_CellPaint( object sender, TableLayoutCellPaintEventArgs e )
 {
     if ( e.Row == 1 || e.Row == 3 )
         e.Graphics.DrawLine( Pens.Silver, e.CellBounds.X, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1 );
 }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// tablelayoutcellpainteventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this TableLayoutCellPaintEventHandler tablelayoutcellpainteventhandler, Object sender, TableLayoutCellPaintEventArgs e, AsyncCallback callback)
        {
            if(tablelayoutcellpainteventhandler == null) throw new ArgumentNullException("tablelayoutcellpainteventhandler");

            return tablelayoutcellpainteventhandler.BeginInvoke(sender, e, callback, null);
        }
        /// <include file='doc\TableLayoutPanel.uex' path='docs/doc[@for="TableLayoutPanel.OnPaint"]/*' />
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);



            // paint borderstyles on top of the background image in WM_ERASEBKGND

            int cellBorderWidth = this.CellBorderWidth;

            TableLayout.ContainerInfo       containerInfo   = TableLayout.GetContainerInfo(this);
            TableLayout.Strip[]             colStrips       = containerInfo.Columns;
            TableLayout.Strip[]             rowStrips       = containerInfo.Rows;
            TableLayoutPanelCellBorderStyle cellBorderStyle = this.CellBorderStyle;



            if (colStrips == null || rowStrips == null)
            {
                return;
            }
            int cols = colStrips.Length;
            int rows = rowStrips.Length;

            int totalColumnWidths = 0, totalColumnHeights = 0;

            Graphics  g           = e.Graphics;
            Rectangle displayRect = DisplayRectangle;
            Rectangle clipRect    = e.ClipRectangle;

            //leave the space for the border
            int  startx;
            bool isRTL = (RightToLeft == RightToLeft.Yes);

            if (isRTL)
            {
                startx = displayRect.Right - (cellBorderWidth / 2);
            }
            else
            {
                startx = displayRect.X + (cellBorderWidth / 2);
            }

            for (int i = 0; i < cols; i++)
            {
                int starty = displayRect.Y + (cellBorderWidth / 2);

                if (isRTL)
                {
                    startx -= colStrips[i].MinSize;
                }

                for (int j = 0; j < rows; j++)
                {
                    Rectangle outsideCellBounds = new Rectangle(startx, starty, ((TableLayout.Strip)colStrips[i]).MinSize, ((TableLayout.Strip)rowStrips[j]).MinSize);

                    Rectangle insideCellBounds = new Rectangle(outsideCellBounds.X + (cellBorderWidth + 1) / 2, outsideCellBounds.Y + (cellBorderWidth + 1) / 2, outsideCellBounds.Width - (cellBorderWidth + 1) / 2, outsideCellBounds.Height - (cellBorderWidth + 1) / 2);

                    if (clipRect.IntersectsWith(insideCellBounds))
                    {
                        //first, call user's painting code
                        using (TableLayoutCellPaintEventArgs pcea = new TableLayoutCellPaintEventArgs(g, clipRect, insideCellBounds, i, j)) {
                            OnCellPaint(pcea);
                        }
                        // paint the table border on top.
                        ControlPaint.PaintTableCellBorder(cellBorderStyle, g, outsideCellBounds);
                    }
                    starty += rowStrips[j].MinSize;
                    // Only sum this up once...
                    if (i == 0)
                    {
                        totalColumnHeights += rowStrips[j].MinSize;
                    }
                }

                if (!isRTL)
                {
                    startx += colStrips[i].MinSize;
                }
                totalColumnWidths += colStrips[i].MinSize;
            }


            if (!HScroll && !VScroll && cellBorderStyle != TableLayoutPanelCellBorderStyle.None)
            {
                Rectangle tableBounds = new Rectangle(cellBorderWidth / 2 + displayRect.X, cellBorderWidth / 2 + displayRect.Y, displayRect.Width - cellBorderWidth, displayRect.Height - cellBorderWidth);
                // paint the border of the table if we are not auto scrolling.
                // if the borderStyle is Inset or Outset, we can only paint the lower bottom half since otherwise we will have 1 pixel loss at the border.
                if (cellBorderStyle == TableLayoutPanelCellBorderStyle.Inset)
                {
                    g.DrawLine(SystemPens.ControlDark, tableBounds.Right, tableBounds.Y, tableBounds.Right, tableBounds.Bottom);
                    g.DrawLine(SystemPens.ControlDark, tableBounds.X, tableBounds.Y + tableBounds.Height - 1, tableBounds.X + tableBounds.Width - 1, tableBounds.Y + tableBounds.Height - 1);
                }
                else if (cellBorderStyle == TableLayoutPanelCellBorderStyle.Outset)
                {
                    using (Pen pen = new Pen(SystemColors.Window)) {
                        g.DrawLine(pen, tableBounds.X + tableBounds.Width - 1, tableBounds.Y, tableBounds.X + tableBounds.Width - 1, tableBounds.Y + tableBounds.Height - 1);
                        g.DrawLine(pen, tableBounds.X, tableBounds.Y + tableBounds.Height - 1, tableBounds.X + tableBounds.Width - 1, tableBounds.Y + tableBounds.Height - 1);
                    }
                }
                else
                {
                    ControlPaint.PaintTableCellBorder(cellBorderStyle, g, tableBounds);
                }
                ControlPaint.PaintTableControlBorder(cellBorderStyle, g, displayRect);
            }
            else
            {
                ControlPaint.PaintTableControlBorder(cellBorderStyle, g, displayRect);
            }
        }
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);
            int cellBorderWidth = this.CellBorderWidth;
            TableLayout.ContainerInfo containerInfo = TableLayout.GetContainerInfo(this);
            TableLayout.Strip[] columns = containerInfo.Columns;
            TableLayout.Strip[] rows = containerInfo.Rows;
            TableLayoutPanelCellBorderStyle cellBorderStyle = this.CellBorderStyle;
            if ((columns != null) && (rows != null))
            {
                int num6;
                int length = columns.Length;
                int num3 = rows.Length;
                int num4 = 0;
                int num5 = 0;
                Graphics g = e.Graphics;
                Rectangle displayRectangle = this.DisplayRectangle;
                Rectangle clipRectangle = e.ClipRectangle;
                bool flag = this.RightToLeft == RightToLeft.Yes;
                if (flag)
                {
                    num6 = displayRectangle.Right - (cellBorderWidth / 2);
                }
                else
                {
                    num6 = displayRectangle.X + (cellBorderWidth / 2);
                }
                for (int i = 0; i < length; i++)
                {
                    int y = displayRectangle.Y + (cellBorderWidth / 2);
                    if (flag)
                    {
                        num6 -= columns[i].MinSize;
                    }
                    for (int j = 0; j < num3; j++)
                    {
                        Rectangle bound = new Rectangle(num6, y, columns[i].MinSize, rows[j].MinSize);
                        Rectangle rect = new Rectangle(bound.X + ((cellBorderWidth + 1) / 2), bound.Y + ((cellBorderWidth + 1) / 2), bound.Width - ((cellBorderWidth + 1) / 2), bound.Height - ((cellBorderWidth + 1) / 2));
                        if (clipRectangle.IntersectsWith(rect))
                        {
                            using (TableLayoutCellPaintEventArgs args = new TableLayoutCellPaintEventArgs(g, clipRectangle, rect, i, j))
                            {
                                this.OnCellPaint(args);
                            }
                            ControlPaint.PaintTableCellBorder(cellBorderStyle, g, bound);
                        }
                        y += rows[j].MinSize;
                        if (i == 0)
                        {
                            num5 += rows[j].MinSize;
                        }
                    }
                    if (!flag)
                    {
                        num6 += columns[i].MinSize;
                    }
                    num4 += columns[i].MinSize;
                }
                if ((base.HScroll || base.VScroll) || (cellBorderStyle == TableLayoutPanelCellBorderStyle.None))
                {
                    ControlPaint.PaintTableControlBorder(cellBorderStyle, g, displayRectangle);
                }
                else
                {
                    Rectangle rectangle5 = new Rectangle((cellBorderWidth / 2) + displayRectangle.X, (cellBorderWidth / 2) + displayRectangle.Y, displayRectangle.Width - cellBorderWidth, displayRectangle.Height - cellBorderWidth);
                    switch (cellBorderStyle)
                    {
                        case TableLayoutPanelCellBorderStyle.Inset:
                            g.DrawLine(SystemPens.ControlDark, rectangle5.Right, rectangle5.Y, rectangle5.Right, rectangle5.Bottom);
                            g.DrawLine(SystemPens.ControlDark, rectangle5.X, (rectangle5.Y + rectangle5.Height) - 1, (rectangle5.X + rectangle5.Width) - 1, (rectangle5.Y + rectangle5.Height) - 1);
                            break;

                        case TableLayoutPanelCellBorderStyle.Outset:
                        {
                            using (Pen pen = new Pen(SystemColors.Window))
                            {
                                g.DrawLine(pen, (rectangle5.X + rectangle5.Width) - 1, rectangle5.Y, (rectangle5.X + rectangle5.Width) - 1, (rectangle5.Y + rectangle5.Height) - 1);
                                g.DrawLine(pen, rectangle5.X, (rectangle5.Y + rectangle5.Height) - 1, (rectangle5.X + rectangle5.Width) - 1, (rectangle5.Y + rectangle5.Height) - 1);
                                break;
                            }
                        }
                        default:
                            ControlPaint.PaintTableCellBorder(cellBorderStyle, g, rectangle5);
                            break;
                    }
                    ControlPaint.PaintTableControlBorder(cellBorderStyle, g, displayRectangle);
                }
            }
        }
Exemplo n.º 34
0
 /// <summary>
 /// Handles the CellPaint event of the <see cref="TableLayoutPanel"/>.
 /// </summary>
 private void TblLogMessageCellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     if (e.Row > 0)
       {
     e.Graphics.DrawLine(
     SystemPens.Control
       , new Point(e.CellBounds.Left,  e.CellBounds.Top)
       , new Point(e.CellBounds.Right, e.CellBounds.Top));
       }
 }
Exemplo n.º 35
0
 private void TableEnemyMember_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 );
 }
Exemplo n.º 36
0
 //CellPaint event handler for your tableLayoutPanel1
 private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
 {
     dict[new TableLayoutPanelCellPosition(e.Column, e.Row)] = e.CellBounds;
         if (moved)
         {
             if (e.CellBounds.Contains(tableLayoutPanel1.PointToClient(MousePosition)))
             {
                 e.Graphics.FillRectangle(Brushes.White, e.CellBounds);
             }
         }
 }