• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.DataGridViewAdvancedBorderStyle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.DataGridViewAdvancedBorderStyle的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewAdvancedBorderStyle类的具体用法?C# DataGridViewAdvancedBorderStyle怎么用?C# DataGridViewAdvancedBorderStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataGridViewAdvancedBorderStyle类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewAdvancedBorderStyle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Paint

 protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
 {
     var buttonRectangle = new Rectangle(cellBounds.X + 2, cellBounds.Y + 2, cellBounds.Width - 4, cellBounds.Height - 4);
     base.Paint(graphics, clipBounds, buttonRectangle, rowIndex, elementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
     var imageRectangle = new Rectangle(cellBounds.X + 6, cellBounds.Y + 6, _detailImage.Width, _detailImage.Height);
     graphics.DrawImage(_detailImage, imageRectangle);
 }
开发者ID:pragmasolutions,项目名称:Libreria,代码行数:7,代码来源:DetailsColumn.cs


示例2: Paint

        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            try
            {
                int progressVal = (int)value;
                if(progressVal < 0) progressVal = 0;
                if(progressVal > 100) progressVal = 100;
                float percentage = ((float)progressVal / 100.0f);

                Brush backColorBrush = new SolidBrush(cellStyle.BackColor);
                Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor);
                Brush barColorBrush = new SolidBrush(GetColorBetween(cellStyle.BackColor,
                    cellStyle.ForeColor, progressVal == 100 ? 0.2f : 0.3f));

                base.Paint(g, clipBounds, cellBounds,
                    rowIndex, cellState, value, formattedValue, errorText,
                    cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));

                var s = progressVal.ToString() + "%";
                var sz = g.MeasureString(s, cellStyle.Font);
                int dy = (cellBounds.Height - this.DataGridView.RowTemplate.Height) / 2;

                g.FillRectangle(barColorBrush, cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4);
                g.DrawString(s, cellStyle.Font, foreColorBrush, cellBounds.X + (cellBounds.Width / 2) - sz.Width / 2 - 5, cellBounds.Y + 2 + dy);
            }
            catch (Exception e) { }
        }
开发者ID:Camel-RD,项目名称:MyDownloder,代码行数:27,代码来源:DataGridViewProgressColumn.cs


示例3: Paint

        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            Tuple<int, string> updateInfo = (Tuple<int, string>)value;
            int progressVal = updateInfo.Item1;
            string message = updateInfo.Item2;

            float percentage = ((float)progressVal / 100.0f); // Need to convert to float before division; otherwise C# returns int which is 0 for anything but 100%.
            Brush backColorBrush = new SolidBrush(cellStyle.BackColor);
            Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor);
            // Draws the cell grid
            base.Paint(g, clipBounds, cellBounds,
             rowIndex, cellState, value, formattedValue, errorText,
             cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));

            
            if (percentage > 0.0)
            {
                // Draw the progress bar and the text
                g.FillRectangle(new SolidBrush(Color.FromArgb(163, 189, 242)), cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4);
                g.DrawString(message, cellStyle.Font, foreColorBrush, cellBounds.X + 6, cellBounds.Y + 2);
            }
            else
            {
                // draw the text
                if (this.DataGridView.CurrentRow.Index == rowIndex)
                    g.DrawString(message, cellStyle.Font, new SolidBrush(cellStyle.SelectionForeColor), cellBounds.X + 6, cellBounds.Y + 2);
                else
                    g.DrawString(message, cellStyle.Font, foreColorBrush, cellBounds.X + 6, cellBounds.Y + 2);
            }
        }
开发者ID:TheTerribleChild,项目名称:Windows-Novel-Reader,代码行数:30,代码来源:NovelListController.cs


示例4: Paint

        protected override void Paint(Graphics graphics,
            Rectangle clipBounds, Rectangle cellBounds, int rowIndex,
            DataGridViewElementStates elementState, object value,
            object formattedValue, string errorText,
            DataGridViewCellStyle cellStyle,
            DataGridViewAdvancedBorderStyle advancedBorderStyle,
            DataGridViewPaintParts paintParts)
        {
            // The button cell is disabled, so paint the border,
            // background, and disabled button for the cell.
            if (!this.enabledValue)
            {
                // Draw the cell background, if specified.
                if ((paintParts & DataGridViewPaintParts.Background) ==
                    DataGridViewPaintParts.Background)
                {
                    SolidBrush cellBackground =
                    new SolidBrush(cellStyle.BackColor);
                    graphics.FillRectangle(cellBackground, cellBounds);
                    cellBackground.Dispose();
                }

                // Draw the cell borders, if specified.
                if ((paintParts & DataGridViewPaintParts.Border) ==
                    DataGridViewPaintParts.Border)
                {
                    PaintBorder(graphics, clipBounds, cellBounds, cellStyle,
                        advancedBorderStyle);
                }

                // Calculate the area in which to draw the button.
                Rectangle buttonArea = cellBounds;
                Rectangle buttonAdjustment =
                    this.BorderWidths(advancedBorderStyle);
                buttonArea.X += buttonAdjustment.X;
                buttonArea.Y += buttonAdjustment.Y;
                buttonArea.Height -= buttonAdjustment.Height;
                buttonArea.Width -= buttonAdjustment.Width;

                // Draw the disabled button.
                ButtonRenderer.DrawButton(graphics, buttonArea, PushButtonState.Disabled);

                // Draw the disabled button text.
                if (this.FormattedValue is String)
                {
                    TextRenderer.DrawText(graphics,
                        (string)this.FormattedValue,
                        this.DataGridView.Font,
                        buttonArea, enabledValue ? SystemColors.ControlText : SystemColors.GrayText);
                }
            }
            else
            {
                // The button cell is enabled, so let the base class
                // handle the painting.
                base.Paint(graphics, clipBounds, cellBounds, rowIndex,
                    elementState, value, formattedValue, errorText,
                   cellStyle, advancedBorderStyle, paintParts);
            }
        }
开发者ID:Diullei,项目名称:Storm,代码行数:60,代码来源:VSintegration.cs


示例5: Paint

        protected override void Paint(Graphics g, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            try
            {
                int progressVal = (int)value;
                float percentage = ((float)progressVal / 100.0f); // Need to convert to float before division; otherwise C# returns int which is 0 for anything but 100%.

                // Draws the cell grid
                base.Paint(g, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));

                // Draw the progress bar and the text
                g.FillRectangle(new SolidBrush(Color.FromArgb(8, 142, 6)), cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4);

                string text = Value.ToString() + "%";
                Font f = cellStyle.Font;

                SizeF len = g.MeasureString(text, f);

                SolidBrush foreColor = new SolidBrush(cellStyle.ForeColor);

                if (DataGridView.Rows[rowIndex].Selected)
                    foreColor = new SolidBrush(cellStyle.SelectionForeColor);

                Point location = new Point(Convert.ToInt32(cellBounds.X + ((cellBounds.Width / 2) - len.Width / 2)), Convert.ToInt32(cellBounds.Y + ((cellBounds.Height / 2) - len.Height / 2)));
                g.DrawString(text, f, foreColor, location);
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Error painting cell");
            }
        }
开发者ID:SteveMoody73,项目名称:Amleto,代码行数:31,代码来源:DataGridViewProgressCell.cs


示例6: Paint

        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            var fillRectangle = new Rectangle(cellBounds.X, cellBounds.Y, cellBounds.Width - 1, cellBounds.Height - 1);
            var stringRectangle = new Rectangle(cellBounds.X + 5, cellBounds.Y + 3, cellBounds.Width - 8, cellBounds.Height - 8);
            graphics.SmoothingMode = SmoothingMode.AntiAlias;
            graphics.FillRectangle(new SolidBrush(Color.FromArgb(215, 228, 242)),
                                   fillRectangle);
            graphics.DrawLine(new Pen(Color.FromArgb(153, 180, 209), 1),
                              new Point(cellBounds.X + cellBounds.Width - 1, cellBounds.Y),
                              new Point(cellBounds.X + cellBounds.Width - 1, cellBounds.Y + cellBounds.Height - 1));
            graphics.DrawLine(new Pen(Color.FromArgb(153, 180, 209), 1),
                              new Point(cellBounds.X, cellBounds.Y + cellBounds.Height - 1),
                              new Point(cellBounds.X + cellBounds.Width - 1, cellBounds.Y + cellBounds.Height - 1));
            //var pen = new Pen(new LinearGradientBrush(new Rectangle(1, 1, 1, 1), 
            //                  Color.FromArgb(0, 0, 0), 
            //                  Color.FromArgb(200, 200, 200), 
            //                  LinearGradientMode.Horizontal))
            //{
            //    DashCap = DashCap.Round,
            //    Width = 1
            //};

            //graphics.DrawLine(pen,
            //                 new Point(cellBounds.X + 7, cellBounds.Y + 7),
            //                 new Point(cellBounds.X + cellBounds.Width - 7, cellBounds.Y + cellBounds.Height - 7));
            //graphics.DrawLine(pen,
            //                 new Point(cellBounds.X + cellBounds.Width - 7, cellBounds.Y + 7),
            //                 new Point(cellBounds.X + 7, cellBounds.Y + cellBounds.Height - 7));
            graphics.DrawString("X",
                                new Font("Comic Sans MS", 9.0f, FontStyle.Regular),
                                new SolidBrush(Color.FromArgb(0, 0, 0)),
                                stringRectangle);
        }
开发者ID:sscctech,项目名称:ServiceBusExplorer,代码行数:33,代码来源:DataGridViewDeleteButtonCell.cs


示例7: Paint

        protected override void Paint(Graphics g, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            int progressVal = 0;
            string label = String.Empty;

            // get progress values
            if (value != null && value.GetType() == typeof(ProgressState))
            {
                ProgressState s = (ProgressState)value;
                progressVal = s.CurrentValue;
                label = s.CurrentState;
                if (s.ShowProgressBar == false || String.IsNullOrEmpty(label) == false)
                    progressVal = 0;
                if (s.HasError)
                    this.ErrorText = s.ErrorText;
            }

            // Draws the cell grid
            base.Paint(g, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));

            // draw progress bar
            float percentage = ((float)progressVal / 100.0f); // Need to convert to float before division; otherwise C# returns int which is 0 for anything but 100%.
            if (percentage > 0.0)
            {
                using (Brush highlightBrush = new SolidBrush(SystemColors.Highlight))
                    g.FillRectangle(highlightBrush, cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4);
            }

            // draw text
            if (String.IsNullOrEmpty(label) == false)
            {
                using (Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor))
                    g.DrawString(label, cellStyle.Font, foreColorBrush, cellBounds.X + 6, cellBounds.Y + 4);
            }
        }
开发者ID:johnreilly,项目名称:tracm,代码行数:35,代码来源:ProgressColumn.cs


示例8: Paint

        protected override void Paint(Graphics graphics,
            Rectangle clipBounds, Rectangle cellBounds, int rowIndex,
            DataGridViewElementStates dataGridViewElementState,
            object value, object formattedValue, string errorText,
            DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle,
            DataGridViewPaintParts paintParts)
        {
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, dataGridViewElementState, value,
                formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
            graphics.FillRectangle(new SolidBrush(cellStyle.BackColor), cellBounds);

            CheckBoxRegion = new Rectangle(
                cellBounds.Location.X + 1,
                cellBounds.Location.Y + 2,
                25, cellBounds.Size.Height - 4);


            if (this.checkAll)
                ControlPaint.DrawCheckBox(graphics, CheckBoxRegion, ButtonState.Checked);
            else
                ControlPaint.DrawCheckBox(graphics, CheckBoxRegion, ButtonState.Normal);

            Rectangle normalRegion =
                new Rectangle(
                cellBounds.Location.X + 1 + 25,
                cellBounds.Location.Y,
                cellBounds.Size.Width - 26,
                cellBounds.Size.Height);

            graphics.DrawString(value.ToString(), cellStyle.Font, new SolidBrush(cellStyle.ForeColor), normalRegion);

        }
开发者ID:cuongpv88,项目名称:work,代码行数:32,代码来源:DGVColumnHeader.cs


示例9: Paint

        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            // the base Paint implementation paints the check box
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);

            // Get the check box bounds: they are the content bounds
            Rectangle contentBounds = this.GetContentBounds(rowIndex);

            // Compute the location where we want to paint the string.
            Point stringLocation = new Point();

            // Compute the Y.
            // NOTE: the current logic does not take into account padding.
            stringLocation.Y = cellBounds.Y + 2;

            // Compute the X.
            // Content bounds are computed relative to the cell bounds
            // - not relative to the DataGridView control.
            stringLocation.X = cellBounds.X + contentBounds.Right + 2;

            // Paint the string.
            if (this.Label == null)
            {
                DataGridViewCheckBoxWithLabelColumn col = (DataGridViewCheckBoxWithLabelColumn) this.OwningColumn;
                this.label = col.Label;
            }

            graphics.DrawString(this.Label, Control.DefaultFont, System.Drawing.Brushes.Red, stringLocation);
        }
开发者ID:osbeorn,项目名称:fireDeptFeesTool,代码行数:29,代码来源:DataGridViewCheckBoxWithLabelColumn.cs


示例10: Paint

 protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {
     if(this.fNowCalculating) {
         this.PaintBackGround(graphics, advancedBorderStyle, cellStyle, cellBounds);
         paintParts &= ~(DataGridViewPaintParts.ContentBackground | DataGridViewPaintParts.Background);
     }
     base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
 }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:7,代码来源:DataGridViewProgressBarCell.cs


示例11: Paint

    protected override void Paint(Graphics graphics, Rectangle clipBounds,
        Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState,
        object value, object formattedValue, string errorText,
        DataGridViewCellStyle cellStyle,
        DataGridViewAdvancedBorderStyle advancedBorderStyle,
        DataGridViewPaintParts paintParts)
    {
      if (Columns.Count > rowIndex)
      {
        Column c = Columns[rowIndex];
        if (c.PrimaryKey)
        {
          Bitmap bmp = rowIndex == DataGridView.CurrentRow.Index ?
              Resources.ArrowKey : Resources.Key;
          bmp.MakeTransparent();
          paintParts &= ~DataGridViewPaintParts.ContentBackground;
          base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState,
              value, formattedValue, errorText, cellStyle, advancedBorderStyle,
              paintParts);
          Rectangle r = cellBounds;
          r.Offset(bmp.Width / 2, bmp.Height / 2);
          r.Width = bmp.Width;
          r.Height = bmp.Height;
          graphics.DrawImage(bmp, r);
          return;
        }
      }

      base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState,
          value, formattedValue, errorText, cellStyle, advancedBorderStyle,
          paintParts);
    }
开发者ID:jimmy00784,项目名称:mysql-connector-net,代码行数:32,代码来源:MyDataGridViewRowHeaderCell.cs


示例12: Paint

        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            if (Image != null)
            {
                base.Paint(graphics, clipBounds,
                           new Rectangle(cellBounds.X + Image.Width, cellBounds.Y, cellBounds.Width - Image.Height,cellBounds.Height),
                           rowIndex, cellState, value, formattedValue,errorText, cellStyle, advancedBorderStyle, paintParts);

                if ((cellState & DataGridViewElementStates.Selected) != 0)
                {
                    graphics.FillRectangle(
                        new SolidBrush(this.DataGridView.DefaultCellStyle.SelectionBackColor)
                        , cellBounds.X, cellBounds.Y, Image.Width, cellBounds.Height);
                }
                else
                {
                    graphics.FillRectangle(new SolidBrush(this.DataGridView.DefaultCellStyle.BackColor),
                                           cellBounds.X, cellBounds.Y, Image.Width, cellBounds.Height);
                }
                graphics.DrawImage(Image, cellBounds.X, cellBounds.Y+2, Image.Width,
                                         Math.Min(Image.Height,cellBounds.Height));

            }
            else
            {
                base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
            }
        }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:28,代码来源:DataGridViewTextAndImageCell.cs


示例13: Paint

        //绘制列头checkbox
        protected override void Paint(System.Drawing.Graphics graphics,
                                      System.Drawing.Rectangle clipBounds,
                                      System.Drawing.Rectangle cellBounds,
                                      int rowIndex,
                                      DataGridViewElementStates dataGridViewElementState,
                                      object value,
                                      object formattedValue,
                                      string errorText,
                                      DataGridViewCellStyle cellStyle,
                                      DataGridViewAdvancedBorderStyle advancedBorderStyle,
                                      DataGridViewPaintParts paintParts)
        {
            base.Paint(graphics, clipBounds, cellBounds, rowIndex,
                        dataGridViewElementState, value,
                        formattedValue, errorText, cellStyle,
                        advancedBorderStyle, paintParts);

            Point p = new Point();
            Size s = CheckBoxRenderer.GetGlyphSize(graphics,
            System.Windows.Forms.VisualStyles.CheckBoxState.UncheckedNormal);
            p.X = cellBounds.Location.X + (cellBounds.Width / 2) - (s.Width / 2) - 1;//列头checkbox的X坐标
            p.Y = cellBounds.Location.Y + (cellBounds.Height / 2) - (s.Height / 2);//列头checkbox的Y坐标
            _cellLocation = cellBounds.Location;
            checkBoxLocation = p;
            checkBoxSize = s;
            if (_checked)
                _cbState = CheckBoxState.CheckedNormal;
            else
                _cbState = CheckBoxState.UncheckedNormal;
            CheckBoxRenderer.DrawCheckBox(graphics, checkBoxLocation, _cbState);
        }
开发者ID:linyc,项目名称:CTool,代码行数:32,代码来源:DataGridViewCheckBoxHeaderCell.cs


示例14: PaintBackGround

 private void PaintBackGround(Graphics graphics, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewCellStyle cellStyle, Rectangle cellBounds) {
     Rectangle rectangle = base.BorderWidths(advancedBorderStyle);
     Rectangle rect = cellBounds;
     rect.Offset(rectangle.X, rectangle.Y);
     rect.Width -= rectangle.Right;
     rect.Height -= rectangle.Bottom;
     using(SolidBrush brush = new SolidBrush(cellStyle.BackColor)) {
         graphics.FillRectangle(brush, rect);
     }
     if(this.lFileSize <= 0L) {
         return;
     }
     Rectangle bounds = rect;
     double num = ((double)this.progressValue) / ((double)this.lFileSize);
     bounds.Width = (int)(bounds.Width * num);
     if(VisualStyleRenderer.IsSupported) {
         try {
             new VisualStyleRenderer(VisualStyleElement.ProgressBar.Chunk.Normal).DrawBackground(graphics, bounds);
             goto Label_00E1;
         }
         catch {
             goto Label_00E1;
         }
     }
     using(SolidBrush brush2 = new SolidBrush(SystemColors.Highlight)) {
         graphics.FillRectangle(brush2, bounds);
     }
 Label_00E1:
     using(StringFormat format = new StringFormat()) {
         format.Alignment = format.LineAlignment = StringAlignment.Center;
         using(SolidBrush brush3 = new SolidBrush(cellStyle.ForeColor)) {
             graphics.DrawString(((int)(num * 100.0)) + "%", cellStyle.Font, brush3, rect, format);
         }
     }
 }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:35,代码来源:DataGridViewProgressBarCell.cs


示例15: Paint

        protected override void Paint(Graphics graphics,
            Rectangle clipBounds,
            Rectangle cellBounds,
            int rowIndex,
            DataGridViewElementStates cellState,
            object value,
            object formattedValue,
            string errorText,
            DataGridViewCellStyle cellStyle,
            DataGridViewAdvancedBorderStyle advancedBorderStyle,
            DataGridViewPaintParts paintParts)
        {
            if (this.DataGridView == null)
            {
                return;
            }

            // First paint the borders and background of the cell.
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle,
                       paintParts & ~(DataGridViewPaintParts.ErrorIcon | DataGridViewPaintParts.ContentForeground));

            IRulesBoxLine myLine = Value as IRulesBoxLine;
            myLine.Selected = this.Selected;
            myLine.Paint(graphics, cellStyle.Font, cellBounds.Left, cellBounds.Top);
        }
开发者ID:killbug2004,项目名称:WSProf,代码行数:25,代码来源:DataGridViewRulesBoxCell.cs


示例16: Paint

			protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex,
				DataGridViewElementStates dataGridViewElementState, object value, object formattedValue, string errorText,
				DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle,
				DataGridViewPaintParts paintParts) {
				graphics.FillRectangle(new SolidBrush(SystemColors.Control), cellBounds);
				if (DataGridView.SelectedCells.Count > 0 &&
				    (DataGridView.SelectedCells[0].ColumnIndex == ColumnIndex ||
				     DataGridView.SelectedCells[0].RowIndex == RowIndex)) {
					ControlPaint.DrawBorder(graphics, cellBounds,
						SystemColors.ControlDarkDark, 1, ButtonBorderStyle.Solid,
						SystemColors.ControlDarkDark, 1, ButtonBorderStyle.Solid,
						SystemColors.ButtonFace, 1, ButtonBorderStyle.Solid,
						SystemColors.ButtonFace, 1, ButtonBorderStyle.Solid);
				}
				else {
					ControlPaint.DrawBorder(graphics, cellBounds,
						SystemColors.ButtonHighlight, 1, ButtonBorderStyle.Solid,
						SystemColors.ButtonHighlight, 1, ButtonBorderStyle.Solid,
						SystemColors.ControlDarkDark, 1, ButtonBorderStyle.Solid,
						SystemColors.ControlDarkDark, 1, ButtonBorderStyle.Solid);

					graphics.DrawLine(SystemPens.ButtonFace,
						cellBounds.Left, cellBounds.Bottom,
						cellBounds.Left, cellBounds.Bottom);
				}

				var bounds = cellBounds;
				bounds.Inflate(-2, -2);
				TextRenderer.DrawText(graphics, (string)formattedValue, cellStyle.Font, bounds,
					cellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Left);
			}
开发者ID:mamingxiu,项目名称:dnExplorer,代码行数:31,代码来源:GridView.cs


示例17: Paint

        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            try
            {
                string text = value == null ? "" : (string)value;
                Brush backColorBrush = new SolidBrush(cellStyle.BackColor);
                Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor);
                var col = this.OwningColumn as DataGridViewColorMarkColumn;
                Color markcolor = cellStyle.ForeColor;
                bool hasmark = col.GetColorMark(rowIndex, out markcolor);
                Brush markColorBrush = new SolidBrush(markcolor);

                base.Paint(g, clipBounds, cellBounds,
                    rowIndex, cellState, value, formattedValue, errorText,
                    cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));

                int rsz = this.DataGridView.RowTemplate.Height - 8;
                int dy = (cellBounds.Height - this.DataGridView.RowTemplate.Height) / 2;

                g.FillEllipse(markColorBrush, cellBounds.X + 2, cellBounds.Y + 4 + dy, rsz, rsz);
                //g.FillRectangle(markColorBrush, cellBounds.X + 2, cellBounds.Y + 4, rsz, rsz);
                g.DrawString(text, cellStyle.Font, foreColorBrush, cellBounds.X + 4 + rsz, cellBounds.Y + 2 + dy);
            }
            catch (Exception e) { }
        }
开发者ID:Camel-RD,项目名称:MyDownloder,代码行数:25,代码来源:DataGridViewColorMarkColumn.cs


示例18: Paint

        protected override void Paint(
            Graphics graphics,
            Rectangle clipBounds,
            Rectangle cellBounds,
            int rowIndex,
            DataGridViewElementStates cellState,
            object value,
            object formattedValue,
            string errorText,
            DataGridViewCellStyle cellStyle,
            DataGridViewAdvancedBorderStyle advancedBorderStyle,
            DataGridViewPaintParts paintParts)
        {
            // Call the base class method to paint the default cell appearance.
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState,
                value, formattedValue, errorText, cellStyle,
                advancedBorderStyle, paintParts);

            // Retrieve the client location of the mouse pointer.
            Point cursorPosition =
                this.DataGridView.PointToClient(Cursor.Position);

            // If the mouse pointer is over the current cell, draw a custom border.
            if (cellBounds.Contains(cursorPosition))
            {
                Rectangle newRect = new Rectangle(cellBounds.X + 1,
                    cellBounds.Y + 1, cellBounds.Width - 4,
                    cellBounds.Height - 4);
                graphics.DrawRectangle(Pens.Red, newRect);
            }
        }
开发者ID:romanu6891,项目名称:fivemen,代码行数:31,代码来源:DataGridViewRolloverCell.cs


示例19: DataGridViewCellPaintingEventArgs

 public DataGridViewCellPaintingEventArgs(DataGridView dataGridView, System.Drawing.Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, int columnIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
 {
     if (dataGridView == null)
     {
         throw new ArgumentNullException("dataGridView");
     }
     if (graphics == null)
     {
         throw new ArgumentNullException("graphics");
     }
     if (cellStyle == null)
     {
         throw new ArgumentNullException("cellStyle");
     }
     if ((paintParts & ~DataGridViewPaintParts.All) != DataGridViewPaintParts.None)
     {
         throw new ArgumentException(System.Windows.Forms.SR.GetString("DataGridView_InvalidDataGridViewPaintPartsCombination", new object[] { "paintParts" }));
     }
     this.graphics = graphics;
     this.clipBounds = clipBounds;
     this.cellBounds = cellBounds;
     this.rowIndex = rowIndex;
     this.columnIndex = columnIndex;
     this.cellState = cellState;
     this.value = value;
     this.formattedValue = formattedValue;
     this.errorText = errorText;
     this.cellStyle = cellStyle;
     this.advancedBorderStyle = advancedBorderStyle;
     this.paintParts = paintParts;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:DataGridViewCellPaintingEventArgs.cs


示例20: Paint

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// </summary>
		/// <param name="graphics">The <see cref="T:System.Drawing.Graphics"/> used to paint
		/// the <see cref="T:System.Windows.Forms.DataGridViewCell"/>.</param>
		/// <param name="clipBounds">A <see cref="T:System.Drawing.Rectangle"/> that represents
		/// the area of the <see cref="T:System.Windows.Forms.DataGridView"/> that needs to be
		/// repainted.</param>
		/// <param name="cellBounds">A <see cref="T:System.Drawing.Rectangle"/> that contains
		/// the bounds of the <see cref="T:System.Windows.Forms.DataGridViewCell"/> that is
		/// being painted.</param>
		/// <param name="rowIndex">The row index of the cell that is being painted.</param>
		/// <param name="elementState"></param>
		/// <param name="value">The data of the <see cref="T:System.Windows.Forms.DataGridViewCell"/>
		/// that is being painted.</param>
		/// <param name="formattedValue">The formatted data of the
		/// <see cref="T:System.Windows.Forms.DataGridViewCell"/> that is being painted.</param>
		/// <param name="errorText">An error message that is associated with the cell.</param>
		/// <param name="cellStyle">A <see cref="T:System.Windows.Forms.DataGridViewCellStyle"/>
		/// that contains formatting and style information about the cell.</param>
		/// <param name="advancedBorderStyle">A
		/// <see cref="T:System.Windows.Forms.DataGridViewAdvancedBorderStyle"/> that contains
		/// border styles for the cell that is being painted.</param>
		/// <param name="paintParts">A bitwise combination of the
		/// <see cref="T:System.Windows.Forms.DataGridViewPaintParts"/> values that specifies
		/// which parts of the cell need to be painted.</param>
		/// ------------------------------------------------------------------------------------
		protected override void Paint(Graphics graphics, Rectangle clipBounds,
			Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState,
			object value, object formattedValue, string errorText,
			DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle,
			DataGridViewPaintParts paintParts)
		{
			Bitmap bitmap = formattedValue as Bitmap;
			if (bitmap == null || !(OwningColumn is CheckGridStatusColumn))
			{
				// We don't know enough to paint this cell, so we let the base class handle it.
				base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value,
					formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
				return;
			}

			// Let base class paint everything except content
			base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value,
				formattedValue, errorText, cellStyle, advancedBorderStyle,
				paintParts & ~(DataGridViewPaintParts.ContentForeground | DataGridViewPaintParts.Background));

			Rectangle cellValueBounds = cellBounds;
			Rectangle borderRect = BorderWidths(advancedBorderStyle);
			cellValueBounds.Offset(borderRect.X, borderRect.Y);
			cellValueBounds.Width -= borderRect.Right;
			cellValueBounds.Height -= borderRect.Bottom;
			if (cellValueBounds.Width <= 0 || cellValueBounds.Height <= 0)
				return;

			if ((paintParts & DataGridViewPaintParts.Background) != 0)
			{
				bool fSelected = (elementState & DataGridViewElementStates.Selected) != 0;
				Color color = (fSelected & (paintParts & DataGridViewPaintParts.SelectionBackground) != 0) ?
					cellStyle.SelectionBackColor : cellStyle.BackColor;
				graphics.FillRectangle(GetCachedBrush(color), cellValueBounds);
			}

			if ((paintParts & DataGridViewPaintParts.ContentForeground) != 0)
			{
				// scale the image according to zoom factor
				float zoomFactor = ((CheckGridStatusColumn)OwningColumn).ZoomFactor;

				int zoomedImageWidth = (int)(bitmap.Width * zoomFactor);
				int zoomedImageHeight = (int)(bitmap.Height * zoomFactor);
				Rectangle drawRect = new Rectangle(
					cellValueBounds.X + (cellValueBounds.Width - zoomedImageWidth) / 2,
					cellValueBounds.Y + (cellValueBounds.Height - zoomedImageHeight) / 2,
					zoomedImageWidth, zoomedImageHeight);

				Region clip = graphics.Clip;
				graphics.SetClip(Rectangle.Intersect(Rectangle.Intersect(drawRect, cellValueBounds),
					Rectangle.Truncate(graphics.VisibleClipBounds)));
				graphics.DrawImage(bitmap, drawRect);
				graphics.Clip = clip;

				ICornerGlyphGrid owningGrid = DataGridView as ICornerGlyphGrid;
				if (owningGrid != null && owningGrid.ShouldDrawCornerGlyph(ColumnIndex, rowIndex))
					DrawCornerGlyph(graphics, rowIndex, cellBounds);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:86,代码来源:CheckGridStatusCell.cs



注:本文中的System.Windows.Forms.DataGridViewAdvancedBorderStyle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.DataGridViewBindingCompleteEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Forms.DataGridView类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap