首页 > 编程语言 >C# DataGridView 禁用或灰显单元格 只读 清除单元格选择

C# DataGridView 禁用或灰显单元格 只读 清除单元格选择

时间:2024-10-26 20:43:48浏览次数:1  
标签:Control 或灰显 只读 C# 单元格 DataGridView 背景色 SystemColors

1. 清除单元格选择

DataGridView.ClearSelection();

效果

2.单元格灰显

// 单元格设为只读
DataGridView.ReadOnly = true;
// 表格背景色
DataGridView.BackgroundColor = SystemColors::Control;
// 标题栏背景色
DataGridView.ColumnHeadersDefaultCellStyle.BackColor = SystemColors::Control;
// 标题栏字体色
DataGridView.ColumnHeadersDefaultCellStyle.ForeColor = SystemColors::GrayText;
// 单元格背景色
DataGridView.DefaultCellStyle.BackColor = SystemColors::Control;
// 单元格字体色
DataGridView.DefaultCellStyle.ForeColor = SystemColors::GrayText;

忽略红框

标签:Control,或灰显,只读,C#,单元格,DataGridView,背景色,SystemColors
From: https://www.cnblogs.com/sandersshine/p/18504471

相关文章

  • Excel导入到MySQL里
    0]MySQL报错出现TheMySQLserverisrunningwiththe--secure-file-privoptionsoitcannotexecutethisstatement。解决办法:1.找到mysql的存储路径:  2.打开my.ini(以记事本方式打开即可)[mysqld]secure_file_priv=''  添加该句。3.重启mysql1]先根据X......
  • JavaScript CSS Vue3 实现一个简单的Loading
    之前项目用到的,后来换其他效果了。放博客里保存一下。效果视频转GIF之后不太流畅……代码<scriptsetuplang="ts">import{onBeforeUnmount,onMounted,ref}from"vue";import{clamp}from"../scripts/Utils";constmaskDiv=ref<HTMLDivElement>(null)co......
  • C++/CLI使用Office.Interop库创建excel,同时解决写入速度慢的问题
    boolWriteExcelFile_OfficeInterop(String^path,DataSet^dt, conststd::vector<std::string>&sheetName,boolhideColumnName) { //Ifthefilealreadyexists,deleteitandthengeneratefile if(System::IO::File::Exists(path)) { try......
  • autofac属性注入
    usingAutofac;namespaceautofac属性注入;internalclassProgram{staticvoidMain(string[]args){//创建一个容器ContainerBuilderbuilder=newContainerBuilder();//注册UserServicebuilder.RegisterType<UserService......
  • C++/CLI 类内多线程编程 多个参数
    usingnamespaceSystem;usingnamespaceSystem::Threading;namespaceNNNN{ publicrefclassTTTT { staticThread^t1; staticThread^t2; voidfun() { t1=gcnewThread(gcnewParameterizedThreadStart(DoWork1)); t2=gcnewThread(gcnewP......
  • 博图SCL编程计算近一小时测量值的均值
    这一篇学习笔记在新浪记录过,这里再次记录一次。1.打开上午的博图程序,新建一个FB块,设置变量参数。2.该FB块新建SCL程序段,写下面的程序3.在OB30循环中断组织块添加一个程序段,调用FB1,添加背景数据块,给输入和输出连接变量。对于新建的FB,刚刚运行时,由于数据量少,没有完全填充......
  • autofac构造函数注入
    usingAutofac;namespaceautofac构造函数注入;internalclassProgram{staticvoidMain(string[]args){//创建一个容器ContainerBuilderbuilder=newContainerBuilder();//注册UserServicebuilder.RegisterType<UserSe......
  • Ubuntu20.04 更新Nvidia驱动 + 安装CUDA12.1 + cudnn8.9.7
    一、概述    最近客户给了几台GPU服务器,长期放置落灰那种,然后想利用起来,所以上去看看了配置,系统是Ubuntu20.04,相关的驱动版本稍嫌老一些,所以需要更新Nvidia驱动,同时在安装CUDA和CUDNN,查看了显卡型号之后,打算使用onnxruntime进行推理,对比了版本,最后选择了CUDA12.1+CU......
  • COMP SCI 7412/4812 Component
    CourseName:SecureSoftwareEngineeringCourseCode:COMPSCI7412/4812AssessmentComponent:SoftwareDesignandPrototypingProject(40%)–GroupandIndividualAssessmentProjectDescriptionTopic:APrivacy-by-DesignHomeServicesApplicationdurin......
  • 搞清楚这个老六的真面目!逐层‘剥开’人工智能中的卷积神经网络(CNN)
    第三章:超越基础——图像中的特征检测上一篇《揭开计算机视觉的神秘面纱,原来机器是这样“看图”的!》本篇序言:上一篇我们实现并训练了一个神经网络,成功让计算机“看懂”了图像。可以说,我们已经一只脚跨进了AI研发的大门。不过,虽然我们迈入了AI这个神秘的领域,实际上,我们还只是......