UISettings Класс

Определение

Содержит набор общих параметров и операций пользовательского интерфейса приложения.

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
Наследование
Object Platform::Object IInspectable UISettings
Атрибуты

Требования к Windows

Семейство устройств
Windows 10 (появилось в 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (появилось в v1.0)

Примеры

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;
  }
}

Комментарии

Журнал версий

Версия Windows Версия пакета SDK Добавленная стоимость
1703 15063 AdvancedEffectsEnabled
1703 15063 AdvancedEffectsEnabledChanged
1903 18362 AutoHideScrollBars
1903 18362 AutoHideScrollBarsChanged
2004 19041 AnimationsEnabledChanged
2004 19041 MessageDurationChanged

Конструкторы

UISettings()

Создает новый экземпляр класса UISettings по умолчанию.

Свойства

AdvancedEffectsEnabled

Возвращает значение, указывающее, включен ли параметр эффектов прозрачности системы.

AnimationsEnabled

Возвращает значение, указывающее, включены ли анимации для пользовательского интерфейса.

AutoHideScrollBars

Возвращает значение, указывающее, указал ли пользователь, что полосы прокрутки должны быть автоматически скрыты, если с ним не выполняется взаимодействие.

CaretBlinkRate

Возвращает частоту мигания нового курсора, созданного представлением приложения.

CaretBrowsingEnabled

Возвращает значение, указывающее, можно ли использовать курсор для операций обзора.

CaretWidth

Возвращает ширину нового курсора, созданного представлением приложения.

CursorSize

Возвращает размер нового курсора, созданного представлением приложения.

DoubleClickTime

Возвращает максимально допустимое время между щелчками в операции двойного щелчка.

HandPreference

Возвращает предпочтение направления пользовательского интерфейса, созданного представлением приложения.

MessageDuration

Возвращает продолжительность отображения сообщения для представления приложения.

MouseHoverTime

Возвращает время, в течение времени, когда указатель мыши может покоится в прямоугольнике на

ScrollBarArrowSize

Возвращает размер стрелки полосы прокрутки для окон, связанных с представлением приложения.

ScrollBarSize

Возвращает размер полосы прокрутки для окон, связанных с представлением приложения.

ScrollBarThumbBoxSize

Возвращает размер большого пальца для окон, связанных с представлением приложения.

TextScaleFactor

Возвращает значение параметра размера системного текста.

Методы

GetColorValue(UIColorType)

Возвращает значение цвета указанного типа цвета.

UIElementColor(UIElementType)

Возвращает цвет, используемый для определенного типа элемента пользовательского интерфейса, например для лицевой стороны кнопки или текста окна.

События

AdvancedEffectsEnabledChanged

Происходит при включении или отключении параметра системных расширенных эффектов пользовательского интерфейса.

AnimationsEnabledChanged

Происходит при изменении значения свойства AnimationsEnabled .

AutoHideScrollBarsChanged

Событие, вызываемое при изменении состояния AutoHideScrollBars .

ColorValuesChanged

Происходит при изменении значений цвета.

MessageDurationChanged

Происходит при изменении значения свойства MessageDuration .

TextScaleFactorChanged

Происходит при изменении параметра системного размера текста.

Применяется к

См. также раздел