TabRenderer.DrawTabItem 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
绘制用于在选项卡控件中选择页面的选项卡。
重载
| 名称 | 说明 |
|---|---|
| DrawTabItem(Graphics, Rectangle, TabItemState) |
绘制处于指定状态和边界的选项卡。 |
| DrawTabItem(Graphics, Rectangle, Boolean, TabItemState) |
绘制处于指定状态和边界的选项卡,并具有可选的焦点矩形。 |
| DrawTabItem(Graphics, Rectangle, String, Font, TabItemState) |
使用指定文本绘制处于指定状态和边界的选项卡。 |
| DrawTabItem(Graphics, Rectangle, Image, Rectangle, Boolean, TabItemState) |
使用指定的图像和可选焦点矩形绘制处于指定状态和边界的选项卡。 |
| DrawTabItem(Graphics, Rectangle, String, Font, Boolean, TabItemState) |
使用指定的文本和可选焦点矩形绘制处于指定状态和边界的选项卡。 |
| DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Boolean, TabItemState) |
使用指定的文本和文本格式以及可选的焦点矩形绘制处于指定状态和边界的选项卡。 |
| DrawTabItem(Graphics, Rectangle, String, Font, Image, Rectangle, Boolean, TabItemState) |
使用指定的文本和图像以及可选的焦点矩形绘制处于指定状态和边界的选项卡。 |
| DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, TabItemState) |
绘制处于指定状态和边界的选项卡;具有指定文本、文本格式和图像;以及具有可选焦点矩形。 |
DrawTabItem(Graphics, Rectangle, TabItemState)
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
绘制处于指定状态和边界的选项卡。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, state As TabItemState)
参数
- state
- TabItemState
TabItemState指定选项卡视觉状态的值之一。
例外
注解
在调用此方法之前,应验证 IsSupported 属性是否 true返回。
适用于
DrawTabItem(Graphics, Rectangle, Boolean, TabItemState)
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
绘制处于指定状态和边界的选项卡,并具有可选的焦点矩形。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, focused As Boolean, state As TabItemState)
参数
- focused
- Boolean
true 绘制焦点矩形;否则,为 false.
- state
- TabItemState
TabItemState指定选项卡视觉状态的值之一。
例外
注解
在调用此方法之前,应验证 IsSupported 属性是否 true返回。
适用于
DrawTabItem(Graphics, Rectangle, String, Font, TabItemState)
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
使用指定文本绘制处于指定状态和边界的选项卡。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, state As TabItemState)
参数
- state
- TabItemState
TabItemState指定选项卡视觉状态的值之一。
例外
注解
在调用此方法之前,应验证 IsSupported 属性是否 true返回。
适用于
DrawTabItem(Graphics, Rectangle, Image, Rectangle, Boolean, TabItemState)
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
使用指定的图像和可选焦点矩形绘制处于指定状态和边界的选项卡。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::Drawing::Image ^ image, System::Drawing::Rectangle imageRectangle, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, image As Image, imageRectangle As Rectangle, focused As Boolean, state As TabItemState)
参数
- focused
- Boolean
true 绘制焦点矩形;否则,为 false.
- state
- TabItemState
TabItemState指定选项卡视觉状态的值之一。
例外
注解
在调用此方法之前,应验证 IsSupported 属性是否 true返回。
适用于
DrawTabItem(Graphics, Rectangle, String, Font, Boolean, TabItemState)
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
使用指定的文本和可选焦点矩形绘制处于指定状态和边界的选项卡。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, focused As Boolean, state As TabItemState)
参数
- focused
- Boolean
true 绘制焦点矩形;否则,为 false.
- state
- TabItemState
TabItemState指定选项卡视觉状态的值之一。
例外
示例
下面的代码示例使用 DrawTabItem(Graphics, Rectangle, String, Font, Boolean, TabItemState) 自定义控件 OnPaint 方法中的方法绘制选项卡项。 该代码示例是 TabRenderer 类中的一个较大示例的一部分。
// Draw the tab page and the tab items.
protected:
virtual void OnPaint(PaintEventArgs^ e) override
{
__super::OnPaint(e);
if (!TabRenderer::IsSupported)
{
this->Parent->Text = "CustomTabControl Disabled";
return;
}
TabRenderer::DrawTabPage(e->Graphics, tabPageRectangle);
TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle1,
tab1Text, this->Font, tab1Focused, tab1State);
TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle2,
tab2Text, this->Font, tab2Focused, tab2State);
this->Parent->Text = "CustomTabControl Enabled";
}
// Draw the tab page and the tab items.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (!TabRenderer.IsSupported)
{
this.Parent.Text = "CustomTabControl Disabled";
return;
}
TabRenderer.DrawTabPage(e.Graphics, tabPageRectangle);
TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle1,
tab1Text, this.Font, tab1Focused, tab1State);
TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle2,
tab2Text, this.Font, tab2Focused, tab2State);
this.Parent.Text = "CustomTabControl Enabled";
}
' Draw the tab page and the tab items.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
If Not TabRenderer.IsSupported Then
Me.Parent.Text = "CustomTabControl Disabled"
Return
End If
TabRenderer.DrawTabPage(e.Graphics, tabPageRectangle)
TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle1, _
tab1Text, Me.Font, tab1Focused, tab1State)
TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle2, _
tab2Text, Me.Font, tab2Focused, tab2State)
Me.Parent.Text = "CustomTabControl Enabled"
End Sub
注解
在调用此方法之前,应验证 IsSupported 属性是否 true返回。
适用于
DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Boolean, TabItemState)
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
使用指定的文本和文本格式以及可选的焦点矩形绘制处于指定状态和边界的选项卡。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, flags As TextFormatFlags, focused As Boolean, state As TabItemState)
参数
- flags
- TextFormatFlags
值的按位组合 TextFormatFlags 。
- focused
- Boolean
true 绘制焦点矩形;否则,为 false.
- state
- TabItemState
TabItemState指定选项卡视觉状态的值之一。
例外
注解
在调用此方法之前,应验证 IsSupported 属性是否 true返回。
适用于
DrawTabItem(Graphics, Rectangle, String, Font, Image, Rectangle, Boolean, TabItemState)
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
使用指定的文本和图像以及可选的焦点矩形绘制处于指定状态和边界的选项卡。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, System::Drawing::Image ^ image, System::Drawing::Rectangle imageRectangle, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, image As Image, imageRectangle As Rectangle, focused As Boolean, state As TabItemState)
参数
- focused
- Boolean
true 绘制焦点矩形;否则,为 false.
- state
- TabItemState
TabItemState指定选项卡视觉状态的值之一。
例外
注解
在调用此方法之前,应验证 IsSupported 属性是否 true返回。
适用于
DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, TabItemState)
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
- Source:
- TabRenderer.cs
绘制处于指定状态和边界的选项卡;具有指定文本、文本格式和图像;以及具有可选焦点矩形。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, System::Drawing::Image ^ image, System::Drawing::Rectangle imageRectangle, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, flags As TextFormatFlags, image As Image, imageRectangle As Rectangle, focused As Boolean, state As TabItemState)
参数
- flags
- TextFormatFlags
值的按位组合 TextFormatFlags 。
- focused
- Boolean
true 绘制焦点矩形;否则,为 false.
- state
- TabItemState
TabItemState指定选项卡视觉状态的值之一。
例外
注解
在调用此方法之前,应验证 IsSupported 属性是否 true返回。