Editar

Compartilhar via


IUIService.Styles Property

Definition

Gets the collection of styles that are specific to the host's environment.

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

Property Value

An IDictionary containing style settings.

Examples

The following code example gets the dialog box font from the host environment.

// 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

Remarks

The dictionary can provide information from the host environment. At a minimum, this consists of the font that should be used for standard UI text, and the color to use for highlighting. These required styles are "DialogFont" and "HighlightColor".

The values for these styles may be retrieved by using the style as a key for the dictionary, accessing the dictionary using the key as an indexer. For example: (object implementing IUIService).Styles[(style name string in quotes)].

Applies to

See also