TextBoxRenderer.DrawTextBox Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Ritar en textrutekontroll med det aktuella visuella formatet för operativsystemet.
Överlagringar
| Name | Description |
|---|---|
| DrawTextBox(Graphics, Rectangle, TextBoxState) |
Ritar en textrutekontroll i det angivna tillståndet och gränserna. |
| DrawTextBox(Graphics, Rectangle, String, Font, TextBoxState) |
Ritar en textrutekontroll i det angivna tillståndet och gränserna och med den angivna texten. |
| DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextBoxState) |
Ritar en textrutekontroll i det angivna tillståndet och gränserna och med angivna text- och textgräns. |
| DrawTextBox(Graphics, Rectangle, String, Font, TextFormatFlags, TextBoxState) |
Ritar en textrutekontroll i det angivna tillståndet och gränserna och med den angivna text- och textformateringen. |
| DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) |
Ritar en textrutekontroll i det angivna tillståndet och gränserna och med angiven text, textgräns och textformatering. |
DrawTextBox(Graphics, Rectangle, TextBoxState)
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
Ritar en textrutekontroll i det angivna tillståndet och gränserna.
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)
Parametrar
- state
- TextBoxState
Ett av de TextBoxState värden som anger det visuella tillståndet för textrutan.
Undantag
Operativsystemet stöder inte visuella format.
-eller-
Visuella format är inaktiverade av användaren i operativsystemet.
-eller-
Visuella format tillämpas inte på klientområdet i programfönster.
Kommentarer
Innan du anropar den här metoden bör du kontrollera att egenskapen IsSupported returnerar true.
Gäller för
DrawTextBox(Graphics, Rectangle, String, Font, TextBoxState)
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
Ritar en textrutekontroll i det angivna tillståndet och gränserna och med den angivna texten.
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);
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)
Parametrar
- state
- TextBoxState
Ett av de TextBoxState värden som anger det visuella tillståndet för textrutan.
Undantag
Operativsystemet stöder inte visuella format.
-eller-
Visuella format är inaktiverade av användaren i operativsystemet.
-eller-
Visuella format tillämpas inte på klientområdet i programfönster.
Kommentarer
Innan du anropar den här metoden bör du kontrollera att egenskapen IsSupported returnerar true.
Gäller för
DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextBoxState)
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
Ritar en textrutekontroll i det angivna tillståndet och gränserna och med angivna text- och textgräns.
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);
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)
Parametrar
- state
- TextBoxState
Ett av de TextBoxState värden som anger det visuella tillståndet för textrutan.
Undantag
Operativsystemet stöder inte visuella format.
-eller-
Visuella format är inaktiverade av användaren i operativsystemet.
-eller-
Visuella format tillämpas inte på klientområdet i programfönster.
Kommentarer
Innan du anropar den här metoden bör du kontrollera att egenskapen IsSupported returnerar true.
Gäller för
DrawTextBox(Graphics, Rectangle, String, Font, TextFormatFlags, TextBoxState)
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
Ritar en textrutekontroll i det angivna tillståndet och gränserna och med den angivna text- och textformateringen.
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);
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)
Parametrar
- flags
- TextFormatFlags
En bitvis kombination av TextFormatFlags värdena.
- state
- TextBoxState
Ett av de TextBoxState värden som anger det visuella tillståndet för textrutan.
Undantag
Operativsystemet stöder inte visuella format.
-eller-
Visuella format är inaktiverade av användaren i operativsystemet.
-eller-
Visuella format tillämpas inte på klientområdet i programfönster.
Kommentarer
Innan du anropar den här metoden bör du kontrollera att egenskapen IsSupported returnerar true.
Gäller för
DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState)
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
- Källa:
- TextBoxRenderer.cs
Ritar en textrutekontroll i det angivna tillståndet och gränserna och med angiven text, textgräns och textformatering.
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);
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)
Parametrar
- flags
- TextFormatFlags
En bitvis kombination av TextFormatFlags värdena.
- state
- TextBoxState
Ett av de TextBoxState värden som anger det visuella tillståndet för textrutan.
Undantag
Operativsystemet stöder inte visuella format.
-eller-
Visuella format är inaktiverade av användaren i operativsystemet.
-eller-
Visuella format tillämpas inte på klientområdet i programfönster.
Exempel
I följande kodexempel visas hur du använder DrawTextBox(Graphics, Rectangle, String, Font, Rectangle, TextFormatFlags, TextBoxState) metoden i en anpassad kontrollmetod OnPaint för att rita en textruta. Det här kodexemplet är en del av ett större exempel för TextBoxRenderer klassen.
// 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
Kommentarer
Innan du anropar den här metoden bör du kontrollera att egenskapen IsSupported returnerar true.