.NET中控件的保护级别(修饰符)自动更改 [英] Protection level (Modifiers) of controls change automaticlly in .Net
问题描述
我的项目在.Net V2.0上,某些控件是公共的,在设计模式下更改窗体时,此控件更改为私有.我怎样才能解决这个问题?谢谢.当修改器更改为私有时,在属性工具箱中,修改器属性不会显示.许多控件都转到 图片2中表格的下方.
我假定您通过编辑
Designer.cs
文件将控件公开,这是因为它们在其中警告您所做的更改将丢失,这是有原因的.
正确的方法是在控件的属性菜单中的设计视图中将控件的Modifers
设置标记为public
.
编辑:好吧,我该死,您没有修饰符选项.好了,这是一种解决方法,创建一个您可以控制的公共属性,该属性可以指向私有成员.
public RadPageView pgvTabsPublic
{
get {return pgvTabs;}
}
使用此方法,您可以让其他类调用yourForm.pgvTabsPublic
,它将把它们指向内部的私有pgvTabs
成员.
My project is on .Net V2.0, some of controls are in public, when change form in design mode this controls changed to private. how can i fix this? thanks. When Modifier changed to private, in Property Tool Box Modifier property not show. many of controls go to below section of form in picture 2.
I assume you are making the controls public by editing the Designer.cs
file, there is a reason they put the warning in there that your changes will be lost.
The correct way is to mark the control's Modifers
setting to public
in design view from the properties menu for your control.
EDIT: Well I'll be damned, you don't have a modifiers option. Well, here is a workaround, create a property that is public that you control that can point at the private member.
public RadPageView pgvTabsPublic
{
get {return pgvTabs;}
}
Using this you can have other classes call yourForm.pgvTabsPublic
and it will point them to the internal private pgvTabs
member.
这篇关于.NET中控件的保护级别(修饰符)自动更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!