TextBoxRenderer.DrawTextBox Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Desenha um controlo de caixa de texto com o estilo visual atual do sistema operativo.
Sobrecargas
| Name | Description |
|---|---|
| DrawTextBox(Graphics, Rectangle, TextBoxState) |
Desenha um controlo de caixa de texto no estado e limites especificados. |
| DrawTextBox(Graphics, Rectangle, String, Font, TextBoxState) |
Desenha um controlo de caixa de texto no estado e limites especificados, e com o texto especificado. |
| DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextBoxState) |
Desenha um controlo de caixa de texto no estado e limites especificados, e com os limites de texto e texto especificados. |
| DrawTextBox(Graphics, Rectangle, String, Font, TextFormatFlags, TextBoxState) |
Desenha um controlo de caixa de texto no estado e limites especificados, e com o texto e a formatação de texto especificados. |
| DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) |
Desenha um controlo de caixa de texto no estado e limites especificados, e com o texto especificado, limites de texto e formatação de texto. |
DrawTextBox(Graphics, Rectangle, TextBoxState)
Desenha um controlo de caixa de texto no estado e limites especificados.
public:
static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, state As TextBoxState)
Parâmetros
- state
- TextBoxState
Um dos TextBoxState valores que especifica o estado visual da caixa de texto.
Exceções
O sistema operativo não suporta estilos visuais.
-ou-
Os estilos visuais são desativados pelo utilizador no sistema operativo.
-ou-
Estilos visuais não são aplicados à área cliente das janelas de aplicação.
Observações
Antes de usar este método, deve verificar se a IsSupported propriedade retorna true.
Aplica-se a
DrawTextBox(Graphics, Rectangle, String, Font, TextBoxState)
Desenha um controlo de caixa de texto no estado e limites especificados, e com o texto especificado.
public:
static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ textBoxText, System::Drawing::Font ^ font, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string textBoxText, System.Drawing.Font font, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, textBoxText As String, font As Font, state As TextBoxState)
Parâmetros
- state
- TextBoxState
Um dos TextBoxState valores que especifica o estado visual da caixa de texto.
Exceções
O sistema operativo não suporta estilos visuais.
-ou-
Os estilos visuais são desativados pelo utilizador no sistema operativo.
-ou-
Estilos visuais não são aplicados à área cliente das janelas de aplicação.
Observações
Antes de usar este método, deve verificar se a IsSupported propriedade retorna true.
Aplica-se a
DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextBoxState)
Desenha um controlo de caixa de texto no estado e limites especificados, e com os limites de texto e texto especificados.
public:
static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ textBoxText, System::Drawing::Font ^ font, System::Drawing::Rectangle textBounds, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string textBoxText, System.Drawing.Font font, System.Drawing.Rectangle textBounds, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Rectangle * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, textBoxText As String, font As Font, textBounds As Rectangle, state As TextBoxState)
Parâmetros
- state
- TextBoxState
Um dos TextBoxState valores que especifica o estado visual da caixa de texto.
Exceções
O sistema operativo não suporta estilos visuais.
-ou-
Os estilos visuais são desativados pelo utilizador no sistema operativo.
-ou-
Estilos visuais não são aplicados à área cliente das janelas de aplicação.
Observações
Antes de usar este método, deve verificar se a IsSupported propriedade retorna true.
Aplica-se a
DrawTextBox(Graphics, Rectangle, String, Font, TextFormatFlags, TextBoxState)
Desenha um controlo de caixa de texto no estado e limites especificados, e com o texto e a formatação de texto especificados.
public:
static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ textBoxText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string textBoxText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, textBoxText As String, font As Font, flags As TextFormatFlags, state As TextBoxState)
Parâmetros
- flags
- TextFormatFlags
Uma combinação bit a bit dos TextFormatFlags valores.
- state
- TextBoxState
Um dos TextBoxState valores que especifica o estado visual da caixa de texto.
Exceções
O sistema operativo não suporta estilos visuais.
-ou-
Os estilos visuais são desativados pelo utilizador no sistema operativo.
-ou-
Estilos visuais não são aplicados à área cliente das janelas de aplicação.
Observações
Antes de usar este método, deve verificar se a IsSupported propriedade retorna true.
Aplica-se a
DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState)
Desenha um controlo de caixa de texto no estado e limites especificados, e com o texto especificado, limites de texto e formatação de texto.
public:
static void DrawTextBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ textBoxText, System::Drawing::Font ^ font, System::Drawing::Rectangle textBounds, System::Windows::Forms::TextFormatFlags flags, System::Windows::Forms::VisualStyles::TextBoxState state);
public static void DrawTextBox(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string textBoxText, System.Drawing.Font font, System.Drawing.Rectangle textBounds, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.TextBoxState state);
static member DrawTextBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Rectangle * System.Windows.Forms.TextFormatFlags * System.Windows.Forms.VisualStyles.TextBoxState -> unit
Public Shared Sub DrawTextBox (g As Graphics, bounds As Rectangle, textBoxText As String, font As Font, textBounds As Rectangle, flags As TextFormatFlags, state As TextBoxState)
Parâmetros
- flags
- TextFormatFlags
Uma combinação bit a bit dos TextFormatFlags valores.
- state
- TextBoxState
Um dos TextBoxState valores que especifica o estado visual da caixa de texto.
Exceções
O sistema operativo não suporta estilos visuais.
-ou-
Os estilos visuais são desativados pelo utilizador no sistema operativo.
-ou-
Estilos visuais não são aplicados à área cliente das janelas de aplicação.
Exemplos
O exemplo de código seguinte demonstra como usar o DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) método num método de controlo OnPaint personalizado para desenhar uma caixa de texto. Este exemplo de código faz parte de um exemplo maior fornecido para a 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
Observações
Antes de usar este método, deve verificar se a IsSupported propriedade retorna true.