UISettings Kelas

Definisi

Berisi sekumpulan pengaturan dan operasi antarmuka pengguna aplikasi umum.

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
Warisan
Object Platform::Object IInspectable UISettings
Atribut

Persyaratan Windows

Rangkaian perangkat
Windows 10 (diperkenalkan dalam 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v1.0)

Contoh

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

Keterangan

Riwayat versi

Versi Windows Versi SDK Nilai ditambahkan
1703 15063 AdvancedEffectsEnabled
1703 15063 AdvancedEffectsEnabledChanged
1903 18362 AutoHideScrollBars
1903 18362 AutoHideScrollBarsChanged
2004 19041 AnimasiEnabledChanged
2004 19041 MessageDurationChanged

Konstruktor

UISettings()

Membuat instans default baru dari kelas UISettings .

Properti

AdvancedEffectsEnabled

Mendapatkan nilai yang menunjukkan apakah pengaturan efek Transparansi sistem diaktifkan.

AnimationsEnabled

Mendapatkan apakah animasi diaktifkan untuk antarmuka pengguna.

AutoHideScrollBars

Mendapatkan apakah pengguna telah menentukan bahwa bilah gulir harus disembunyikan secara otomatis saat tidak berinteraksi.

CaretBlinkRate

Mendapatkan tingkat kedipan dari tanda sisipan baru yang dibuat oleh tampilan aplikasi.

CaretBrowsingEnabled

Mendapatkan apakah tanda sisipan dapat digunakan untuk menelusuri operasi.

CaretWidth

Mendapatkan lebar tanda sisipan baru yang dibuat oleh tampilan aplikasi.

CursorSize

Mendapatkan ukuran kursor baru yang dibuat oleh tampilan aplikasi.

DoubleClickTime

Mendapatkan waktu maksimum yang diizinkan antara klik dalam operasi klik ganda.

HandPreference

Mendapatkan preferensi arah antarmuka pengguna yang dibuat oleh tampilan aplikasi.

MessageDuration

Mendapatkan lamanya waktu pesan ditampilkan untuk tampilan aplikasi.

MouseHoverTime

Mendapatkan jumlah waktu penunjuk mouse dapat beristirahat dalam persegi panjang hover sebelum peristiwa hover dinaikkan.

ScrollBarArrowSize

Mendapatkan ukuran panah bilah gulir untuk jendela yang terkait dengan tampilan aplikasi.

ScrollBarSize

Mendapatkan ukuran bilah gulir untuk jendela yang terkait dengan tampilan aplikasi.

ScrollBarThumbBoxSize

Mendapatkan ukuran kotak jempol untuk jendela yang terkait dengan tampilan aplikasi.

TextScaleFactor

Mendapatkan nilai pengaturan ukuran teks sistem.

Metode

GetColorValue(UIColorType)

Mengembalikan nilai warna dari jenis warna yang ditentukan.

UIElementColor(UIElementType)

Mendapatkan warna yang digunakan untuk jenis elemen antarmuka pengguna tertentu, seperti wajah tombol atau teks jendela.

Acara

AdvancedEffectsEnabledChanged

Terjadi ketika pengaturan efek UI tingkat lanjut sistem diaktifkan atau dinonaktifkan.

AnimationsEnabledChanged

Terjadi ketika nilai properti AnimationsEnabled telah berubah.

AutoHideScrollBarsChanged

Peristiwa dipanggil saat status AutoHideScrollBars berubah.

ColorValuesChanged

Terjadi ketika nilai warna telah berubah.

MessageDurationChanged

Terjadi ketika nilai properti MessageDuration telah berubah.

TextScaleFactorChanged

Terjadi ketika pengaturan ukuran teks sistem diubah.

Berlaku untuk

Lihat juga