IUIService.Styles Egenskap

Definition

Hämtar den samling formatmallar som är specifika för värdens miljö.

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

Egenskapsvärde

En IDictionary som innehåller formatinställningar.

Exempel

I följande kodexempel hämtas dialogrutans teckensnitt från värdmiljön.

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

Kommentarer

Ordlistan kan ge information från värdmiljön. Detta består åtminstone av det teckensnitt som ska användas för standardtext i användargränssnittet och den färg som ska användas för markering. De här formatmallarna är "DialogFont" och "HighlightColor".

Värdena för dessa formatmallar kan hämtas med hjälp av formatet som en nyckel för ordlistan och komma åt ordlistan med nyckeln som indexerare. Till exempel: (objekt som implementerar IUIService). Styles[(style name string in quotes)].

Gäller för

Se även