禁用列标题单击事件 [英] disable the column header click event

查看:108
本文介绍了禁用列标题单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var bcol = new DataGridViewButtonColumn
           {
               HeaderText = @"Action",
               Text = "DoNotRTI",
               Name = "btnInsert",
               UseColumnTextForButtonValue = true,
               SortMode=DataGridViewColumnSortMode.NotSortable

           };



我使用此代码创建了按钮列我需要


I have created button column using this code i need to

disable the column header click event

推荐答案

试试这个



GridView1.HeaderRow.Cells [0] .Enabled = false;
Try with this

GridView1.HeaderRow.Cells[0].Enabled = false;


不订阅任何事件的方法。这样点击它就不会有任何后果。
Don't subscribe any method to the event. That way clicking on it won't have any consequences.


这篇关于禁用列标题单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆