C# 批量设置WinForm界面上的所有控件不可编辑

上传者: hekainy | 上传时间: 2020-01-03 11:21:37 | 文件大小: 68KB | 文件类型: rar
本例中,为WinForm提供方法,批量设置其界面上所有的控件为不可编辑状态 方法: SetReadOnly( Control.ControlCollection , List , List) 说明: 当窗体内的控件存在[ReadOnly]属性时,只设置[ReadOnly]属性,否则设置[Enabled]属性 方法中,List参数提供时,代表不修改其可编辑性,保持其状态为原始的可编辑或不可编辑 List参数,布尔值表示是否同时忽略修改其子控件,如放在GroupBox内的按钮 List参数,该列表内的类型的控件均不修改其可编辑属性,如Label控件一般不设置可编辑性。

文件下载

资源详情

[{"title":"( 30 个子文件 68KB ) C# 批量设置WinForm界面上的所有控件不可编辑","children":[{"title":"SetReadOnly","children":[{"title":"SetReadOnly.sln <span style='color:#111;'> 923B </span>","children":null,"spread":false},{"title":"SetReadOnly","children":[{"title":"TestForm.resx <span style='color:#111;'> 7.14KB </span>","children":null,"spread":false},{"title":"bin","children":[{"title":"Debug","children":[{"title":"SetReadOnly.pdb <span style='color:#111;'> 37.50KB </span>","children":null,"spread":false},{"title":"SetReadOnly.vshost.exe.manifest <span style='color:#111;'> 490B </span>","children":null,"spread":false},{"title":"SetReadOnly.vshost.exe <span style='color:#111;'> 13.99KB </span>","children":null,"spread":false},{"title":"SetReadOnly.exe <span style='color:#111;'> 26.00KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"obj","children":[{"title":"Debug","children":[{"title":"SetReadOnly.pdb <span style='color:#111;'> 37.50KB </span>","children":null,"spread":false},{"title":"SetReadOnly.Properties.Resources.resources <span style='color:#111;'> 1.76KB </span>","children":null,"spread":false},{"title":"Refactor","children":null,"spread":false},{"title":"SetReadOnly.TestForm.resources <span style='color:#111;'> 1.14KB </span>","children":null,"spread":false},{"title":"SetReadOnly.csproj.FileListAbsolute.txt <span style='color:#111;'> 953B </span>","children":null,"spread":false},{"title":"SetReadOnly.exe <span style='color:#111;'> 26.00KB </span>","children":null,"spread":false},{"title":"TempPE","children":[{"title":"Properties.Resources.Designer.cs.dll <span style='color:#111;'> 4.50KB </span>","children":null,"spread":false}],"spread":true},{"title":"SetReadOnly.MainForm.resources <span style='color:#111;'> 1.33KB </span>","children":null,"spread":false},{"title":"SetReadOnly.csproj.GenerateResource.Cache <span style='color:#111;'> 950B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"Resources","children":[{"title":"Start.bmp <span style='color:#111;'> 1.30KB </span>","children":null,"spread":false}],"spread":true},{"title":"Properties","children":[{"title":"Resources.Designer.cs <span style='color:#111;'> 3.02KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 249B </span>","children":null,"spread":false},{"title":"Resources.resx <span style='color:#111;'> 6.05KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.07KB </span>","children":null,"spread":false},{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.33KB </span>","children":null,"spread":false}],"spread":true},{"title":"Program.cs <span style='color:#111;'> 495B </span>","children":null,"spread":false},{"title":"TestForm.Designer.cs <span style='color:#111;'> 28.19KB </span>","children":null,"spread":false},{"title":"SetReadOnly.csproj <span style='color:#111;'> 4.16KB </span>","children":null,"spread":false},{"title":"MainForm.resx <span style='color:#111;'> 6.91KB </span>","children":null,"spread":false},{"title":"Icon1.ico <span style='color:#111;'> 1.05KB </span>","children":null,"spread":false},{"title":"MainForm.cs <span style='color:#111;'> 500B </span>","children":null,"spread":false},{"title":"CommonHelpers.cs <span style='color:#111;'> 8.51KB </span>","children":null,"spread":false},{"title":"TestForm.cs <span style='color:#111;'> 1.82KB </span>","children":null,"spread":false},{"title":"MainForm.Designer.cs <span style='color:#111;'> 3.07KB </span>","children":null,"spread":false}],"spread":false},{"title":"SetReadOnly.suo <span style='color:#111;'> 18.00KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

  • sunrayljs1 :
    测试了一下,还不错
    2017-03-25
  • longwinmartin :
    很好用,我改了一下,非常有帮助
    2016-02-01
  • zhou_scorpion :
    很有帮助,谢谢
    2015-05-13
  • 冷深深 :
    我觉得这个只能用在教学上,真正项目最好用 devespress 中的 readonly ,它不会变灰色
    2014-10-19
  • 罗罗罗罗罗罗 :
    非常好的资源,在项目中很好用!!
    2014-10-10

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明