轉帖|其它|編輯:郝浩|2008-07-17 10:54:40.000|閱讀 948 次
概述:與IDE相關的Attribute屬性(C#)
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Description Attribute:對于屬性或是事件的描述,當用戶選取該屬性或事件時,其會顯示于屬性表下方。
范例:
view plaincopy to clipboardprint?
[Description(“The text to display.”)]
ublic string Text{……}
[Description(“The text to display.”)]
Public string Text{……}
Category Attribute:對于屬性或是事件的分類,當屬性表采用分類模式顯示時,會以此Attribute作為分類的依據。
范例:
view plaincopy to clipboardprint?
[Category(“Layout”)]
Public string Text{……}
[Category(“Layout”)]
Public string Text{……}
Browsable Attribute:控制屬性或事件是否顯示于屬性表。
范例:
view plaincopy to clipboardprint?
[Browsable(false)]
ublic string NoVisible
[Browsable(false)]
Public string NoVisible
EditorBrowsable Attribute:控制屬性或事件是否顯示于IntelliSense窗口中,表B-1是可能的值。
Never 不顯示
Always 顯示
Advanced 僅顯示于進階用戶模式,進階者模式可通過Tools|Options|Text Editor|C#中打開
范例:
view plaincopy to clipboardprint?
[EditorBrowsable(EditorBrowsableState.Never)]
ublic string Text
[EditorBrowsable(EditorBrowsableState.Never)]
Public string Text
DefaultEvent Attribute: 指定默認的事件,當用戶于組件/控件上雙擊鼠標時,Editor會建立此事件函數。
范例:
view plaincopy to clipboardprint?
[DefaultEvent(“Click”)]
ublic class MyButton
[DefaultEvent(“Click”)]
Public class MyButton
DefaultProperty Attribute:指定默認的屬性
范例:
view plaincopy to clipboardprint?
[DefaultProperty(“Text”)]
ublic class MyButton
[DefaultProperty(“Text”)]
Public class MyButton
ReadOnly Attribute:指定屬性是否只讀。
范例:
view plaincopy to clipboardprint?
[ReadOnly(true)]
ublic int MyProperty
[ReadOnly(true)]
Public int MyProperty
Bindable Attribute:指定屬性是否支持Data Binding。
范例:
view plaincopy to clipboardprint?
[Bindable(true)]
ublic int MyProperty
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉載自:CSDN