Joa*_*nge 19 .net c# gdi+ winforms
这是隐藏派生控件中属性的方法吗?
public class NewButton : Button
...
[Browsable ( false )]
public new ContentAlignment TextAlign { get; set; }
Run Code Online (Sandbox Code Playgroud)
此外,这会在设计器的"属性"窗口中隐藏属性,但是如何在代码中隐藏属性?
Mar*_*ell 27
从代码中,最接近你可以隐藏它,也许直接调用很麻烦 - 请注意,即使隐藏它也是可调用的,并且这些都不会通过强制转换:
// about the closest you can do, but not really an answer
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("just cast me to avoid all this hiding...", true)]
public new ContentAlignment TextAlign { get; set; }
Run Code Online (Sandbox Code Playgroud)
就个人而言,我不会打扰.它不健壮(只是演员).
| 归档时间: |
|
| 查看次数: |
20667 次 |
| 最近记录: |