IUIService.Styles 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
獲得與主持人環境相關的風格集合。
public:
property System::Collections::IDictionary ^ Styles { System::Collections::IDictionary ^ get(); };
public System.Collections.IDictionary Styles { get; }
member this.Styles : System.Collections.IDictionary
Public ReadOnly Property Styles As IDictionary
屬性值
包含 IDictionary 風格設定。
範例
以下程式碼範例取自主機環境的對話框字型。
// The specified IDesigner implements IUIService.
System::Drawing::Font^ GetFont( IDesigner^ designer )
{
System::Drawing::Font^ hostfont;
// Gets the dialog box font from the host environment.
hostfont = dynamic_cast<System::Drawing::Font^>(dynamic_cast<IUIService^>(designer)->Styles[ "DialogFont" ]);
return hostfont;
}
// The specified IDesigner implements IUIService.
Font GetFont(IDesigner designer)
{
Font hostfont;
// Gets the dialog box font from the host environment.
hostfont = (Font)((IUIService)designer).Styles["DialogFont"];
return hostfont;
}
' The specified IDesigner implements IUIService.
Function GetFont(designer As IDesigner) As Font
Dim hostfont As Font
' Gets the dialog box font from the host environment.
hostfont = CType(CType(designer, IUIService).Styles("DialogFont"), Font)
Return hostfont
End Function
備註
字典可以從主機環境提供資訊。 至少,這包括標準 UI 文字應該使用的字體,以及用於高亮的顏色。 這些必備樣式是「DialogFont」和「HighlightColor」。
這些樣式的值可以透過將樣式作為字典的鍵值,並以鍵作為索引器存取字典來取得。 例如:(物件實作 IUIService)。樣式[(風格名稱字串以引號內標示)]。