UISettings Classe

Définition

Contient un ensemble de paramètres et d’opérations d’interface utilisateur d’application courants.

public ref class UISettings sealed
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class UISettings final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class UISettings final
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class UISettings
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class UISettings
function UISettings()
Public NotInheritable Class UISettings
Héritage
Object Platform::Object IInspectable UISettings
Attributs

Configuration requise pour Windows

Famille d’appareils
Windows 10 (introduit dans 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduit dans v1.0)

Exemples

void MainPage::ClickHandler(IInspectable const&, RoutedEventArgs const&)
{
    Windows::UI::ViewManagement::UISettings uiSettings;

    std::wstringstream buffer;
    Windows::UI::Color color{ uiSettings.UIElementColor(UIElementType::ActiveCaption) };

    buffer << L"Hand Preference " << (uiSettings.HandPreference() == HandPreference::RightHanded ? L"right" : L"left") << std::endl;
    buffer << L"Cursor Size " << uiSettings.CursorSize().Width << L" x " << uiSettings.CursorSize().Height << std::endl;
    buffer << L"Scrollbar Size " << uiSettings.ScrollBarSize().Width << L" x " << uiSettings.ScrollBarSize().Height << std::endl;
    buffer << L"Scrollbar Arrow Size " << uiSettings.ScrollBarArrowSize().Width << L" x " << uiSettings.ScrollBarArrowSize().Height << std::endl;
    buffer << L"Scrollbar Thumb Box Size " << uiSettings.ScrollBarThumbBoxSize().Width << L" x " << uiSettings.ScrollBarThumbBoxSize().Height << std::endl;
    buffer << L"Message Duration " << uiSettings.MessageDuration() << std::endl;
    buffer << L"Animations Enabled " << (uiSettings.AnimationsEnabled() ? L"true" : L"false") << std::endl;
    buffer << L"Caret Browsing Enabled " << (uiSettings.CaretBrowsingEnabled() ? L"true" : L"false") << std::endl;
    buffer << L"Caret Blink Rate " << uiSettings.CaretBlinkRate() << std::endl;
    buffer << L"Caret Width " << uiSettings.CaretWidth() << std::endl;
    buffer << L"Double Click Time " << uiSettings.DoubleClickTime() << std::endl;
    buffer << L"Mouse Hover Time " << uiSettings.MouseHoverTime() << std::endl;

    buffer << L"System Colors: " << std::endl;

    buffer << L"Active Caption: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::Background);
    buffer << L"Background: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::ButtonFace);
    buffer << L"Button Face: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::ButtonText);
    buffer << L"Button Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::CaptionText);
    buffer << L"Caption Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::GrayText);
    buffer << L"Gray Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::Highlight);
    buffer << L"Highlight: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::HighlightText);
    buffer << L"Highlight Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::Hotlight);
    buffer << L"Hotlight: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::InactiveCaption);
    buffer << L"Inactive Caption: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::InactiveCaptionText);
    buffer << L"Inactive Caption Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::Window);
    buffer << L"Window: " << color.R << L", " << color.G << L", " << color.B << std::endl;
    color = uiSettings.UIElementColor(UIElementType::WindowText);
    buffer << L"Window Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;

    UIOutputTextBlock().Text(buffer.str().c_str());
}
void SDKSample::HighContrast::UI::UIGetSettings_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{ 
  Button^ b = safe_cast<Button^>(sender);
  if (b != nullptr)
  {
    UISettings^ pUserSettings = ref new UISettings();
    Platform::String^ Buffer;
    Windows::UI::Color Color;

        Buffer =  "Hand Preference " + (pUserSettings->HandPreference == HandPreference::RightHanded ? "right" : "left") + "\n";
        Buffer += "Cursor Size "  + pUserSettings->CursorSize.Width.ToString() + " x " + pUserSettings->CursorSize.Height.ToString() + "\n";
        Buffer += "Scrollbar Size "  + pUserSettings->ScrollBarSize.Width.ToString() + " x " + pUserSettings->ScrollBarSize.Height.ToString() + "\n";
        Buffer += "Scrollbar Arrow Size "   + pUserSettings->ScrollBarArrowSize.Width.ToString() + " x " + pUserSettings->ScrollBarArrowSize.Height.ToString() + "\n";
        Buffer += "Scrollbar Thumb Box Size " + pUserSettings->ScrollBarThumbBoxSize.Width.ToString() + " x " + pUserSettings->ScrollBarThumbBoxSize.Height.ToString() + "\n";
        Buffer += "Message Duration "  + pUserSettings->MessageDuration.ToString() + "\n";
        Buffer += "Animations Enabled "  + (pUserSettings->AnimationsEnabled ? "true" : "false") + "\n"; 
        Buffer += "Caret Browsing Enabled "  + (pUserSettings->CaretBrowsingEnabled ? "true" : "false") + "\n";
        Buffer += "Caret Blink Rate "  + pUserSettings->CaretBlinkRate.ToString() + "\n";
        Buffer += "Caret Width " + pUserSettings->CaretWidth.ToString() + "\n";
        Buffer += "Double Click Time " + pUserSettings->DoubleClickTime.ToString() + "\n";
        Buffer += "Mouse Hover Time " + pUserSettings->MouseHoverTime.ToString() + "\n";

        Buffer += "System Colors: \n";

        Color = pUserSettings->UIElementColor(UIElementType::ActiveCaption);
        Buffer += "Active Caption: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::Background);
        Buffer += "Background: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::ButtonFace);
        Buffer += "Button Face: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::ButtonText);
        Buffer += "Button Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::CaptionText);
        Buffer += "Caption Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::GrayText);
        Buffer += "Gray Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::Highlight);
        Buffer += "Highlight: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::HighlightText);
        Buffer += "Highlight Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::Hotlight);
        Buffer += "Hotlight: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::InactiveCaption);
        Buffer += "Inactive Caption: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::InactiveCaptionText);
        Buffer += "Inactive Caption Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::Window);
        Buffer += "Window: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::WindowText);
        Buffer += "Window Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";

    UIOutputTextBlock->Text = Buffer;
  }
}

Remarques

Historique des versions

Version de Windows Version du SDK Valeur ajoutée
1703 15063 AdvancedEffectsEnabled
1703 15063 AdvancedEffectsEnabledChanged
1903 18362 AutoHideScrollBars
1903 18362 AutoHideScrollBarsChanged
2004 19041 AnimationsEnabledChanged
2004 19041 MessageDurationChanged

Constructeurs

UISettings()

Crée une nouvelle instance par défaut de la classe UISettings.

Propriétés

AdvancedEffectsEnabled

Obtient une valeur qui indique si le paramètre d’effets de transparence système est activé.

AnimationsEnabled

Obtient si les animations sont activées pour l’interface utilisateur.

AutoHideScrollBars

Obtient si l’utilisateur a spécifié que les barres de défilement doivent être automatiquement masquées lorsqu’elles n’interagissent pas avec.

CaretBlinkRate

Obtient le taux de clignotement d’un nouveau caret créé par la vue d’application.

CaretBrowsingEnabled

Obtient si le caret peut être utilisé pour les opérations de navigation.

CaretWidth

Obtient la largeur d’un nouveau caret créé par la vue d’application.

CursorSize

Obtient la taille d’un nouveau curseur créé par la vue d’application.

DoubleClickTime

Obtient la durée maximale autorisée entre les clics dans une opération de double-clic.

HandPreference

Obtient la préférence directionnelle de l’interface utilisateur créée par la vue d’application.

MessageDuration

Obtient la durée d’affichage d’un message pour l’affichage de l’application.

MouseHoverTime

Obtient la durée pendant laquelle le pointeur de la souris peut se reposer dans un rectangle de pointage avant qu’un événement de pointage ne soit déclenché.

ScrollBarArrowSize

Obtient la taille d’une flèche de barre de défilement pour les fenêtres associées à la vue d’application.

ScrollBarSize

Obtient la taille d’une barre de défilement pour les fenêtres associées à la vue d’application.

ScrollBarThumbBoxSize

Obtient la taille d’une zone de pouce pour les fenêtres associées à la vue d’application.

TextScaleFactor

Obtient la valeur du paramètre de taille de texte système.

Méthodes

GetColorValue(UIColorType)

Retourne la valeur de couleur du type de couleur spécifié.

UIElementColor(UIElementType)

Obtient la couleur utilisée pour un type d’élément d’interface utilisateur spécifique, tel qu’un visage de bouton ou un texte de fenêtre.

Événements

AdvancedEffectsEnabledChanged

Se produit lorsque le paramètre d’effets avancés de l’interface utilisateur système est activé ou désactivé.

AnimationsEnabledChanged

Se produit lorsque la valeur de la propriété AnimationsEnabled a changé.

AutoHideScrollBarsChanged

Événement appelé lorsque l’état AutoHideScrollBars change.

ColorValuesChanged

Se produit lorsque les valeurs de couleur ont changé.

MessageDurationChanged

Se produit lorsque la valeur de la propriété MessageDuration a changé.

TextScaleFactorChanged

Se produit lorsque le paramètre de taille de texte système est modifié.

S’applique à

Voir aussi