TabRenderer.DrawTabPage(Graphics, Rectangle) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在指定範圍中繪製索引標籤頁。
public:
static void DrawTabPage(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds);
public static void DrawTabPage (System.Drawing.Graphics g, System.Drawing.Rectangle bounds);
static member DrawTabPage : System.Drawing.Graphics * System.Drawing.Rectangle -> unit
Public Shared Sub DrawTabPage (g As Graphics, bounds As Rectangle)
參數
例外狀況
範例
下列程式碼範例會 DrawTabPage 使用自訂控制項的 方法中的 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
回 。