TabControlArray.DrawItem 事件


如果 TabControl 屬性設定為 DrawMode,在 OwnerDrawFixed 需要繪製它的每一個索引標籤時發生。Occurs when the TabControl needs to paint each of its tabs if the DrawMode property is set to OwnerDrawFixed.

 event System::Windows::Forms::DrawItemEventHandler ^ DrawItem;
public event System.Windows.Forms.DrawItemEventHandler DrawItem;
member this.DrawItem : System.Windows.Forms.DrawItemEventHandler 
Public Event DrawItem As DrawItemEventHandler 


當您將 [DrawMode] 屬性設定為 [OwnerDrawFixed] 時,TabControl 會在需要繪製其其中一個索引標籤時引發 DrawItem 事件。When you set the DrawMode property to OwnerDrawFixed, the TabControl raises the DrawItem event whenever it needs to paint one of its tabs. 若要自訂索引標籤的外觀,請在 DrawItem 事件的處理常式中提供您自己的繪製程式碼。To customize the appearance of the tabs, provide your own painting code in a handler for the DrawItem event.

TabControl 不支援具有擁有者繪製的變數索引標籤大小。The TabControl does not support variable tab sizes with owner drawing.

如需如何處理事件的詳細資訊,請參閱處理和引發事件For more information about how to handle events, see Handling and Raising Events.


Microsoft.VisualBasic.Compatibility.VB6 命名空間中的函式和物件都是供這些工具使用,以便從 Visual Basic 6.0 升級至 Visual Basic。Functions and objects in the Microsoft.VisualBasic.Compatibility.VB6 namespace are provided for use by the tools for upgrading from Visual Basic 6.0 to Visual Basic. 在大多數情況下,這些函式和物件會複製在 .NET Framework.NET Framework 的其他命名空間中可以找到的功能。In most cases, these functions and objects duplicate functionality that you can find in other namespaces in the .NET Framework.NET Framework. 只有當 Visual Basic 6.0 程式碼模型與 .NET Framework.NET Framework 實作有顯著差異時,才需要這些項目。They are necessary only when the Visual Basic 6.0 code model differs significantly from the .NET Framework.NET Framework implementation.