TextBoxRenderer.IsSupported Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient une valeur indiquant si la classe TextBoxRenderer peut être utilisée pour dessiner une zone de texte avec des styles visuels.
public:
static property bool IsSupported { bool get(); };
public static bool IsSupported { get; }
static member IsSupported : bool
Public Shared ReadOnly Property IsSupported As Boolean
Valeur de propriété
true
si l'utilisateur a activé les styles visuels dans le système d'exploitation et s'ils sont appliqués à la zone client des fenêtres d'application ; sinon false
.
Exemples
L’exemple de code suivant utilise la IsSupported propriété pour déterminer s’il faut utiliser la DrawTextBox méthode . Cet exemple de code fait partie d’un exemple plus grand fourni pour la TextBoxRenderer classe .
// 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
Remarques
Si cette propriété est false
, la DrawTextBox méthode lève un InvalidOperationException.
S’applique à
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour