2005中,窗体继承有时,有的控件在子窗体中无法修改的问题,谁搞定了,或有好的方法,项目更新到一半出了这个问题不得不停止了,痛苦中...

xietangz 2006-02-20 05:53:34
如题!
...全文
216 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
addwing 2006-06-23
  • 打赏
  • 举报
回复
关注,学习。
levinknight 2006-06-22
  • 打赏
  • 举报
回复
在窗体继承中,2.0中新的控件都是不能修改属性的。微软说这是一个FEATURE。

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=02f9cd99-08a7-4efa-92d0-99a53b91d302#Workarounds

...
Thank you for your comments. This is a known design time limitation that we will not be addressing in this Visual Studio 2005 release. We will look at improving this in future versions.
cdo 2006-03-01
  • 打赏
  • 举报
回复
你把dataGridView改成protected或public的。
wxdl1981 2006-03-01
  • 打赏
  • 举报
回复
那么就在运行的时候用代码的方式修改它, 或直接修改父窗体. 有疑问吗?
codehunter008 2006-02-28
  • 打赏
  • 举报
回复
This is a known design time limitation .

Form designer doesn’t allow to modify properties of all new for .Net Framework 2.0 controls
(ToolStrip, MenuStrip, ContextMenuStrip, StatusStrip, TableLayoutPanel, FlowLayoutPanel, DataGridView, BindingNavigator) belonging to inherited form even if the value of access modifier on parental form has been established to public or protected. Nevertheless all these properties can be modified in the program code of inherited form.
We don’t have the same problem with controls, which already existed in .Net 1.1 (TabControl, Panel, TextBox, Button… and others).


http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=02f9cd99-08a7-4efa-92d0-99a53b91d302#Workarounds



ToolStrip, MenuStrip, ContextMenuStrip, StatusStrip, TableLayoutPanel, FlowLayoutPanel, DataGridView, BindingNavigator
xietangz 2006-02-21
  • 打赏
  • 举报
回复


两位误解了,父FORM中控件的属性为public,继承的子FORM中此控件应是可以操作的,但现在子FORM中此控件为只读的,如dataGridView控件,操作一下就明白了!
jiezhi 2006-02-20
  • 打赏
  • 举报
回复
和普通class的继承是类似的,你不可能去掉父类的成员,也不能改名字,但你可以改其它属性
wxdl1981 2006-02-20
  • 打赏
  • 举报
回复
继承窗体中Private的控件是不能修改的.
解决方法有两个:
1. 在基类窗体改成Protected;
2. 在程序运行时遍历Form.Controls属性,找到并修改控件.

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧