<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      DataGridView DataGridViewCheckBoxColumn 實現禁用效果,因為默認的不帶禁用效果

      /// <summary>
      /// DataGridViewDisableCheckBoxColumn 
      /// 自定義disablecheckbox列 實現禁用效果
      /// </summary>
      public class DataGridViewDisableCheckBoxColumn : DataGridViewCheckBoxColumn
      {
          public DataGridViewDisableCheckBoxColumn()
          {
              this.CellTemplate = new DataGridViewDisableCheckBoxCell();
          }
      }
      
      public class DataGridViewDisableCheckBoxCell : DataGridViewCheckBoxCell
      {
          private bool enabledValue;
      
          public bool Enabled
          {
              get
              {
                  return enabledValue;
              }
              set
              {
                  enabledValue = value;
              }
          }
      
          public override object Clone()
          {
              DataGridViewDisableCheckBoxCell cell =
                  (DataGridViewDisableCheckBoxCell)base.Clone();
              cell.Enabled = this.Enabled;
              return cell;
          }
      
          public DataGridViewDisableCheckBoxCell()
          {
              this.enabledValue = true;
          }
      
          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)
          {
              if (!this.enabledValue)
              {
                  if ((paintParts & DataGridViewPaintParts.Background) ==
                      DataGridViewPaintParts.Background)
                  {
                      SolidBrush cellBackground =
                          new SolidBrush(cellStyle.BackColor);
                      graphics.FillRectangle(cellBackground, cellBounds);
                      cellBackground.Dispose();
                  }
      
                  if ((paintParts & DataGridViewPaintParts.Border) ==
                      DataGridViewPaintParts.Border)
                  {
                      PaintBorder(graphics, clipBounds, cellBounds, cellStyle,
                          advancedBorderStyle);
                  }
      
                  CheckBoxState state = value != null && (bool)value ?
                      CheckBoxState.CheckedDisabled : CheckBoxState.UncheckedDisabled;
                  Size size = CheckBoxRenderer.GetGlyphSize(graphics, state);
                  Point center = new Point(cellBounds.X, cellBounds.Y);
                  center.X += (cellBounds.Width - size.Width) / 2;
                  center.Y += (cellBounds.Height - size.Height) / 2;
      
                  CheckBoxRenderer.DrawCheckBox(graphics, center, state);
              }
              else
              {
                  base.Paint(graphics, clipBounds, cellBounds, rowIndex,
                      elementState, value, formattedValue, errorText,
                      cellStyle, advancedBorderStyle, paintParts);
              }
          }
      }
      

       使用:
       private void dgvView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)

      {

          if (e.RowIndex < 0 || e.ColumnIndex > colSelect.Index) { return; }

       

          DataRow dr = (dgvView.Rows[e.RowIndex].DataBoundItem as DataRowView)?.Row;

          if (dr != null)

          {

              string status= DataFun.ConvertToStringByDB(dr["status"]);

       

              if (status!= 'Doing')

              {

                  DataGridViewDisableCheckBoxCell checkCell = (DataGridViewDisableCheckBoxCell)dgvView.Rows[e.RowIndex].Cells[colSelect.Index];

                  if (checkCell == null) { return; }

       

                  checkCell.Enabled = false;

                  checkCell.ReadOnly = true;

              }

          }

      }

       

      posted @ 2024-09-23 09:02  威爾遜  閱讀(75)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 午夜一区二区三区视频| 欧美丰满熟妇性xxxx| 日韩中文字幕v亚洲中文字幕 | 国产亚洲一在无在线观看| 在线国产毛片| 国产精品三级中文字幕| 98精品全国免费观看视频| 四虎国产精品成人| 国内极度色诱视频网站| 精品亚洲国产成人av在线| 亚洲精品日韩中文字幕| 久久丫精品国产| 欧美激情一区二区| 91高清免费国产自产拍| 日本一卡2卡3卡四卡精品网站| 国产精品爽爽久久久久久竹菊| 亚洲成人av一区免费看| 亚洲欧美日韩高清一区二区三区| 婷婷四虎东京热无码群交双飞视频 | 白白发布视频一区二区视频| 国产高清在线不卡一区| 久久久久久久无码高潮| 午夜夜福利一区二区三区| 日产国产一区二区不卡| 国产精品毛片大码女人| 亚洲欧洲日产国码久在线| 2021国产精品视频网站| 隔壁老王国产在线精品| 久热天堂在线视频精品伊人| 老太脱裤子让老头玩xxxxx| 97人人模人人爽人人喊网| 97碰碰碰免费公开在线视频| 亚洲国产日韩一区三区| 菏泽市| 久久精品色一情一乱一伦| 欧美不卡无线在线一二三区观| 亚洲中文字幕在线二页| 欧美精品一产区二产区| 91无码人妻精品一区二区蜜桃| 免费无码一区无码东京热| 久久国产一区二区日韩av|