TextBoxRenderer.IsSupported Własność
Definicja
Ważny
Niektóre informacje dotyczą produktów przedpremierowych, które mogą zostać znacznie zmodyfikowane przed premierą. Microsoft nie udziela żadnych gwarancji, ani wyraźnych, ani domniemanych, dotyczących informacji podanych tutaj.
Pobiera wartość wskazującą, czy TextBoxRenderer klasa może służyć do rysowania pola tekstowego ze stylami wizualnymi.
public:
static property bool IsSupported { bool get(); };
public static bool IsSupported { get; }
static member IsSupported : bool
Public Shared ReadOnly Property IsSupported As Boolean
Wartość nieruchomości
true jeśli użytkownik włączył style wizualne w systemie operacyjnym i stylach wizualnych są stosowane do obszaru klienta okien aplikacji; w przeciwnym razie , false.
Przykłady
W poniższym przykładzie kodu użyto IsSupported właściwości , aby określić, czy należy użyć DrawTextBox metody . Ten przykład kodu jest częścią większego przykładu udostępnionego TextBoxRenderer dla klasy .
// Use DrawText with the current TextFormatFlags.
protected:
virtual void OnPaint(PaintEventArgs^ e) override
{
__super::OnPaint(e);
if (TextBoxRenderer::IsSupported)
{
TextBoxRenderer::DrawTextBox(e->Graphics, textBorder, this->Text,
this->Font, textRectangle, textFlags, TextBoxState::Normal);
this->Parent->Text = "CustomTextBox Enabled";
}
else
{
this->Parent->Text = "CustomTextBox Disabled";
}
}
// Use DrawText with the current TextFormatFlags.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (TextBoxRenderer.IsSupported)
{
TextBoxRenderer.DrawTextBox(e.Graphics, textBorder, this.Text,
this.Font, textRectangle, textFlags, TextBoxState.Normal);
this.Parent.Text = "CustomTextBox Enabled";
}
else
{
this.Parent.Text = "CustomTextBox Disabled";
}
}
' Use DrawText with the current TextFormatFlags.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
If TextBoxRenderer.IsSupported Then
TextBoxRenderer.DrawTextBox(e.Graphics, textBorder, Me.Text, _
Me.Font, textRectangle, textFlags, TextBoxState.Normal)
Me.Parent.Text = "CustomTextBox Enabled"
Else
Me.Parent.Text = "CustomTextBox Disabled"
End If
End Sub
Uwagi
Jeśli ta właściwość ma falsewartość , DrawTextBox metoda zgłosi błąd InvalidOperationException.