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)
绘制具有指定状态和边界的选项卡。
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)
绘制具有指定的状态和边界以及可选聚焦框的选项卡。
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)
绘制具有指定的状态和边界以及指定的文本的选项卡。
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)
绘制具有指定的状态和边界、指定的图像以及可选聚焦框的选项卡。
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)
绘制具有指定的状态和边界、指定的文本以及可选聚焦框的选项卡。
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)
绘制具有指定的状态和边界、指定的文本和文本格式以及可选聚焦框的选项卡。
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)
绘制具有指定的状态和边界、指定的文本和图像以及可选聚焦框的选项卡。
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)
绘制具有指定的状态和边界、指定的文本、文本格式和图像以及可选聚焦框的选项卡。
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
返回 。