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

C# Forms.DataGridViewCellStyle类代码示例

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

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



DataGridViewCellStyle类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewCellStyle类的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: SetRowDefaultCellStyle

        /// <summary>
        /// 设置行样式
        /// </summary>
        /// <param name="dgvCellStyle"></param>
        public void SetRowDefaultCellStyle(DataGridViewCellStyle dgvCellStyle)
        {
            if (dgvCellStyle == null)
                return;

            textdataGrid.DefaultCellStyle = dgvCellStyle;
        }
开发者ID:keep01,项目名称:efwplus_winformframe,代码行数:11,代码来源:CardDataGrid.cs


示例3: InitializeEditingControl

        public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
            DataGridViewFADateTimePickerEditor editor = Editor;

            if (editor != null)
            {
                var column = GetColumn();

                editor.RightToLeft = DataGridView.RightToLeft;
                editor.Theme = column.Theme;

                var formattedValue = initialFormattedValue.ToString();

                if (string.IsNullOrEmpty(formattedValue))
                {
                    editor.SelectedDateTime = DateTime.Now;
                    editor.mv.MonthViewControl.SetNoneDay();
                }
                else
                {
                    editor.SelectedDateTime = GetParsedDate(formattedValue);
                }
            }
        }
开发者ID:HEskandari,项目名称:FarsiLibrary,代码行数:25,代码来源:DataGridViewFADateTimePickerColumn.cs


示例4: ApplyColors

        private void ApplyColors()
        {
            foreach (DataGridViewRow dgRow in dgViewResults.Rows)
            {
                DataGridViewCellStyle styleRed = new DataGridViewCellStyle();
                styleRed.ForeColor = Color.Red;

                DataGridViewCellStyle styleGreen = new DataGridViewCellStyle();
                styleGreen.ForeColor = Color.Green;

                DataGridViewCellStyle styleYellow = new DataGridViewCellStyle();
                styleYellow.ForeColor = Color.Orange;

                if (Convert.ToInt32(dgRow.Cells[1].Value) <= 3)
                {
                    dgRow.DefaultCellStyle = styleRed;
                }
                else if (Convert.ToInt32(dgRow.Cells[1].Value) == 5)
                {
                    dgRow.DefaultCellStyle = styleGreen;
                }
                else
                {
                    dgRow.DefaultCellStyle = styleYellow;
                }
            }
        }
开发者ID:Jim-1960,项目名称:mkv-chapterizer,代码行数:27,代码来源:ChapterDB.cs


示例5: InitializeEditingControl

 public override void InitializeEditingControl(int rowIndex, object
     initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
 {
     try
     {
         // Set the value of the editing control to the current cell value. 
         base.InitializeEditingControl(rowIndex, initialFormattedValue,
             dataGridViewCellStyle);
         CalendarEditingControl ctl =
             DataGridView.EditingControl as CalendarEditingControl;
         // Use the default row value when Value property is null. 
         if (this.Value == null)
         {
             ctl.Value = (DateTime)this.DefaultNewRowValue;
         }
         else
         {
             ctl.Value = (DateTime)this.Value;
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
 }
开发者ID:sumitglobussoft,项目名称:Instagram-PVA-BOT,代码行数:25,代码来源:AddDateTimePickerInGRV.cs


示例6: 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


示例7: GetFormattedValue

        protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, System.ComponentModel.TypeConverter valueTypeConverter, System.ComponentModel.TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context)
        {
            Guid obj = (Guid) value;
            string val = PaymentController.GetInstance().GetCustomer(obj).ToString();

            return val;
        }
开发者ID:altmer,项目名称:study-projects,代码行数:7,代码来源:CustomerIDColumn.cs


示例8: SchedulerWindow

        public SchedulerWindow()
        {
            _warningsToDeploy = new List<DisplayEvent>();
            _deployedWarnings = new List<DisplayEvent>();
            _buttonToEventLookup = new Dictionary<int, Tuple<string, DateTime>>();
            _scheduler = new Scheduler();

            InitializeComponent();
            this.MaximizeBox = false;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            UpdateSchedulerTable(fieldEdited: true);
            UpdateCalendar();

            ClearEventDetails();

            _dailyReminderTask = new Task(DailyReminder);
            _dailyReminderTask.Start();

            _urgentStyle = new DataGridViewCellStyle();
            _urgentStyle.BackColor = Color.LightPink;
            _urgentStyle.SelectionBackColor = Color.LightPink;
            _warningStyle = new DataGridViewCellStyle();
            _warningStyle.BackColor = Color.LightYellow;
            _warningStyle.SelectionBackColor = Color.LightYellow;
            _defaultStyle = new DataGridViewCellStyle();
            _defaultStyle.BackColor = Color.LightGreen;
            _defaultStyle.SelectionBackColor = Color.LightGreen;
            EventTable.ClearSelection();
        }
开发者ID:GorelH,项目名称:Scheduler,代码行数:30,代码来源:SchedulerWindow.cs


示例9: Form1

        public Form1()
        {
            InitializeComponent();
            lctrl = new LoanCtrl();
            // To get the right list enter string name of the list, this is made for direct access
            // to the list so the checkboxes respond directly
            dataGridView1.DataSource = lctrl.GetDirectList("loans");
            dataGridView1.BackgroundColor = Color.Silver;
            dataGridView1.Columns[3].Visible = true;
            dataGridView1.Columns[0].ReadOnly = true;
            dataGridView1.Columns[1].ReadOnly = true;
            dataGridView1.Columns[2].ReadOnly = true;

            DataGridViewCellStyle style = new DataGridViewCellStyle();
            DataGridViewCellStyle styleHeader = new DataGridViewCellStyle();
            style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            styleHeader.Alignment = DataGridViewContentAlignment.MiddleCenter;
            styleHeader.Padding = new Padding(20, 0, 0, 0);
            dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGray;
            dataGridView1.EnableHeadersVisualStyles = false;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.RowsDefaultCellStyle.SelectionBackColor = Color.DeepSkyBlue;
            dataGridView1.RowsDefaultCellStyle.SelectionForeColor = Color.Black;
            dataGridView1.RowHeadersVisible = false;
            foreach (DataGridViewColumn column in dataGridView1.Columns)
            {
                column.HeaderCell.Style = styleHeader;
                column.DefaultCellStyle = style;
            }
            dataGridView1.Columns[3].HeaderCell.Style = style;
        }
开发者ID:janix89,项目名称:DebtsAccounting,代码行数:31,代码来源:Form1.cs


示例10: 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


示例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(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


示例12: InitializeEditingControl

 public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
 {
     // Set the value of the editing control to the current cell value.
     base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
     MonthPaidControl ctl = DataGridView.EditingControl as MonthPaidControl;
     ctl.Value = (DateTime)GetValue(rowIndex);
 }
开发者ID:altmer,项目名称:study-projects,代码行数:7,代码来源:MonthPaidColumn.cs


示例13: DataGridViewRowPostPaintEventArgs

 /// <include file='doc\DataGridViewRowPostPaintEventArgs.uex' path='docs/doc[@for="DataGridViewRowPostPaintEventArgs.DataGridViewRowPostPaintEventArgs"]/*' />
 public DataGridViewRowPostPaintEventArgs(DataGridView dataGridView,
                                          Graphics graphics, 
                                          Rectangle clipBounds, 
                                          Rectangle rowBounds,
                                          int rowIndex,
                                          DataGridViewElementStates rowState,
                                          string errorText,
                                          DataGridViewCellStyle inheritedRowStyle,
                                          bool isFirstDisplayedRow,
                                          bool isLastVisibleRow)
 {
     if (dataGridView == null)
     {
         throw new ArgumentNullException("dataGridView");
     }
     if (graphics == null)
     {
         throw new ArgumentNullException("graphics");
     }
     if (inheritedRowStyle == null)
     {
         throw new ArgumentNullException("inheritedRowStyle");
     }
     this.dataGridView = dataGridView;
     this.graphics = graphics;
     this.clipBounds = clipBounds;
     this.rowBounds = rowBounds;
     this.rowIndex = rowIndex;
     this.rowState = rowState;
     this.errorText = errorText;
     this.inheritedRowStyle = inheritedRowStyle;
     this.isFirstDisplayedRow = isFirstDisplayedRow;
     this.isLastVisibleRow = isLastVisibleRow;
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:35,代码来源:DataGridViewRowPostPaintEventArgs.cs


示例14: MapPackageManager

        public MapPackageManager(Form1 formRef)
        {
            InitializeComponent();
            mainForm = formRef;

            // Get list of maps from server
            using (WebClient wc = new WebClient())
            {
                var json = wc.DownloadString("http://hack.fyi/rlmaps/maps.json");

                List<MapPackageJson> maps  = JsonConvert.DeserializeObject<List<MapPackageJson>>(json);

                foreach(MapPackageJson mpj in maps)
                {
                    mapPackages.Add(mpj.mapPackage);
                }
            }

            dataGridView1.DataSource = mapPackages;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            dataGridView1.Columns["FileUrl"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.RowsDefaultCellStyle.SelectionBackColor = System.Drawing.Color.Transparent;
            DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();
            columnHeaderStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

            dataGridView1.ColumnHeadersDefaultCellStyle = columnHeaderStyle;

            packageStatusLabel.Text = "Downloaded initial map list.";
        }
开发者ID:timunrue,项目名称:RLMapLoader,代码行数:30,代码来源:MapPackageManager.cs


示例15: GetStatusRowStyle

        /// <summary>
        /// 状态行样式
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public DataGridViewCellStyle GetStatusRowStyle(int s)
        {
            DataGridViewCellStyle dr = new DataGridViewCellStyle();

            switch (s)
            {
                case 1://放送中
                    dr.ForeColor = Color.White;
                    dr.BackColor = Color.Navy;

                    break;
                case 2://完结
                    dr.ForeColor = Color.FromArgb(0, 97, 0);
                    dr.BackColor = Color.FromArgb(198, 239, 206);
                    break;
                case 3://新企划
                    dr.ForeColor = Color.DarkRed;
                    dr.BackColor = Color.LightPink;
                    break;
                case 9://弃置
                    dr.ForeColor = Color.Black;
                    dr.BackColor = Color.LightGray;
                    break;
            }
            return dr;
        }
开发者ID:kirisamex,项目名称:Animedata,代码行数:31,代码来源:StatusStyle.cs


示例16: DataGridViewCellStyle

 /// <include file='doc\DataGridViewCellStyle.uex' path='docs/doc[@for="DataGridViewCellStyle.DataGridViewCellStyle2"]/*' />
 public DataGridViewCellStyle(DataGridViewCellStyle dataGridViewCellStyle)
 {
     if (dataGridViewCellStyle == null)
     {
         throw new ArgumentNullException("dataGridViewCellStyle");
     }
     this.propertyStore = new PropertyStore();
     this.scope = DataGridViewCellStyleScopes.None;
     this.BackColor = dataGridViewCellStyle.BackColor;
     this.ForeColor = dataGridViewCellStyle.ForeColor;
     this.SelectionBackColor = dataGridViewCellStyle.SelectionBackColor;
     this.SelectionForeColor = dataGridViewCellStyle.SelectionForeColor;
     this.Font = dataGridViewCellStyle.Font;
     this.NullValue = dataGridViewCellStyle.NullValue;
     this.DataSourceNullValue = dataGridViewCellStyle.DataSourceNullValue;
     this.Format = dataGridViewCellStyle.Format;
     if (!dataGridViewCellStyle.IsFormatProviderDefault)
     {
         this.FormatProvider = dataGridViewCellStyle.FormatProvider;
     }
     this.AlignmentInternal = dataGridViewCellStyle.Alignment;
     this.WrapModeInternal = dataGridViewCellStyle.WrapMode;
     this.Tag = dataGridViewCellStyle.Tag;
     this.PaddingInternal = dataGridViewCellStyle.Padding;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:26,代码来源:DataGridViewCellStyle.cs


示例17: DataGridViewBgColor

        /// <summary>
        /// DataGridViewEx 边框 背景色 选中色 隔行换色 设置
        /// </summary>
        /// <param name="dgv">DataGridViewEx</param>
        public static void DataGridViewBgColor(DataGridViewEx dgv)
        {
            var dataGridViewCellStyle1 = new DataGridViewCellStyle();
            var dataGridViewCellStyle2 = new DataGridViewCellStyle();
            var dataGridViewCellStyle3 = new DataGridViewCellStyle();
            var dataGridViewCellStyle4 = new DataGridViewCellStyle();
            dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
            dgv.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;

            dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(240, 241, 243);
            dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold);
            dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(51, 51, 51);
            dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle2.WrapMode = DataGridViewTriState.True;            
            dgv.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;

            //选中行颜色
            dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(255, 246, 150);
            dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular);
            dgv.RowsDefaultCellStyle = dataGridViewCellStyle3;
            dgv.GridColor = System.Drawing.Color.FromArgb(221, 221, 221);

            //序号列样式-行标题背景色 选中色
            dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(224, 236, 255);
            dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(224, 236, 255);          
            dgv.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
            //行标题边框样式
            dgv.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
            
        }
开发者ID:caocf,项目名称:workspace-kepler,代码行数:36,代码来源:DataGridViewStyle.cs


示例18: InitializeEditingControl

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Attaches and initializes the hosted editing control.
		/// </summary>
		/// <param name="rowIndex">The index of the row being edited.</param>
		/// <param name="initialFormattedValue">The initial value to be displayed in the
		/// control.</param>
		/// <param name="dataGridViewCellStyle">A cell style that is used to determine the
		/// appearance of the hosted control.</param>
		/// <PermissionSet>
		///		<IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/>
		///		<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/>
		///		<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence"/>
		///		<IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/>
		/// </PermissionSet>
		/// ------------------------------------------------------------------------------------
		public override void InitializeEditingControl(int rowIndex, object initialFormattedValue,
			DataGridViewCellStyle dataGridViewCellStyle)
		{
			base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
			FwTextBoxControl ctrl = DataGridView.EditingControl as FwTextBoxControl;
			InitializeTextBoxControl(ctrl, rowIndex);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:23,代码来源:FwTextBoxCell.cs


示例19: 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


示例20: ParseFormattedValue

        public override object ParseFormattedValue(
            object formattedValue,
            DataGridViewCellStyle cellStyle,
            TypeConverter formattedValueTypeConverter,
            TypeConverter valueTypeConverter)
        {
            int result;

            if (int.TryParse(formattedValue.ToString(), NumberStyles.HexNumber, null, out result))
            {
                //Hex number
                return base.ParseFormattedValue(
                    "0x" + formattedValue,
                    cellStyle,
                    formattedValueTypeConverter,
                    valueTypeConverter
                    );
            }

            return base.ParseFormattedValue(
                formattedValue,
                cellStyle,
                formattedValueTypeConverter,
                valueTypeConverter
                );
        }
开发者ID:me-viper,项目名称:OutputColorer,代码行数:26,代码来源:ColorPickerCell.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Forms.DataGridViewCellValidatingEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Forms.DataGridViewCellPaintingEventArgs类代码示例发布时间: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