1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/// <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 威尔逊 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 目的是使用老的webpages页面 实时编译的,用于处理紧急情况,可以热编译1.删掉designer.cs 2.修改aspx 文件的第一行<%%>中的属性名 CodeBehind="test.aspx.cs" --改成 CodeFile="Test.aspx.cs" 3.修改aspx.cs文件 一般 阅读全文
posted @ 2023-09-22 11:19 威尔逊 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 一般是程序里面 开启事务未提交或回滚导致 1. 查询哪些对象存在死锁 select object_name,machine,s.sid,s.serial# from v$locked_object l,dba_objects o ,v$session s where l.object_id = o. 阅读全文
posted @ 2022-06-23 17:11 威尔逊 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 进入vi的命令 vi filename :打开或新建文件,并将光标置于第一行首 vi +n filename :打开文件,并将光标置于第n行首 vi + filename :打开文件,并将光标置于最后一行首 vi +/pattern filename:打开文件,并将光标置于第一个与pattern匹配 阅读全文
posted @ 2021-12-18 11:09 威尔逊 阅读(1314) 评论(0) 推荐(0) 编辑
摘要: 在目标托管映像的同位置创建一个同名 .ini 文件,其内容如下:[.NET Framework Debugging Control]GenerateTrackingInfo=1AllowOptimize=0 阅读全文
posted @ 2021-11-03 14:00 威尔逊 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 26个日文片假名会导致Access搜索( 内存溢出)ゴ ガ ギ グ ゲ ザ ジ ズ ヅ デ ド ポ ベ プ ビ パ ヴ ボ ペ ブ ピ バ ヂ ダ ゾ ゼ解决方案: title like '%关键字%'like 换成 instr替代即可InStr(1,LCase(title),LCase('关键字' 阅读全文
posted @ 2021-09-26 14:57 威尔逊 阅读(125) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2021-03-12 16:43 威尔逊 阅读(0) 评论(0) 推荐(0) 编辑
摘要: public static T DeepCloneObject<T>(T obj) where T : class { //System.String类型似乎比较特殊,复制它的所有字段,并不能复制它本身 //不过由于System.String的不可变性,即使指向同一对象,也无所谓 //而且.NET里 阅读全文
posted @ 2020-07-14 17:02 威尔逊 阅读(138) 评论(0) 推荐(0) 编辑
摘要: SELECT owner, segment_name, SUM(bytes /1024/1024 /1024) sum FROM dba_segments where owner = ‘用户' and segment_name = '表名' GROUP BY owner,segment_name 阅读全文
posted @ 2020-05-28 14:50 威尔逊 阅读(334) 评论(0) 推荐(0) 编辑
摘要: Redis链接密码修改,Redis命令行进入,如图7006端口为master其他的7000-7005为slave,按以下步骤修改master节点的requirepass ,和修改所有slave节点的masterauth和requirepass。 注意: 1.一定要config rewrite不然重启 阅读全文
posted @ 2020-05-15 10:49 威尔逊 阅读(948) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示