Class TabRendererBase
A default ITabRenderer implementation from which your custom tab renderers could derive.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Tools
Assembly: Syncfusion.Tools.Windows.dll
Syntax
public abstract class TabRendererBase : ITabRenderer, IDisposable
Constructors
TabRendererBase(ITabControl, ITabPanelRenderer)
Creates an instance of the TabRendererBase.
Declaration
public TabRendererBase(ITabControl parent, ITabPanelRenderer panelRenderer)
Parameters
Type | Name | Description |
---|---|---|
ITabControl | parent | The ITabControl instance. |
ITabPanelRenderer | panelRenderer | The parent ITabPanelRenderer instance. |
Fields
ImageTextPadding
Indicates the Image text padding.
Declaration
public static int ImageTextPadding
Field Value
Type |
---|
System.Int32 |
panelRenderer
Initialize the tab panel renderer.
Declaration
protected ITabPanelRenderer panelRenderer
Field Value
Type |
---|
ITabPanelRenderer |
Properties
Bounds
Gets / sets the current bounds of this tab. See Bounds.
Declaration
public virtual RectangleF Bounds { get; set; }
Property Value
Type |
---|
System.Drawing.RectangleF |
CloseButtonBackColor
Gets or sets the value whether close button should be visible for each tab.
Declaration
public Color CloseButtonBackColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
CloseButtonBounds
Gets the bounds of the close button.
Declaration
public Rectangle CloseButtonBounds { get; }
Property Value
Type |
---|
System.Drawing.Rectangle |
CloseButtonClicked
Gets or sets the value whether close button is clicked.
Declaration
public virtual bool CloseButtonClicked { get; set; }
Property Value
Type |
---|
System.Boolean |
CloseButtonPadding
Gets space in pixels between tab's interior and close button.
Declaration
public virtual int CloseButtonPadding { get; }
Property Value
Type |
---|
System.Int32 |
CloseButtonSize
Gets CloseButton size.
Declaration
public virtual int CloseButtonSize { get; }
Property Value
Type |
---|
System.Int32 |
CorrectCloseButtonPosition
Gets correct close button point.
Declaration
protected virtual Point CorrectCloseButtonPosition { get; }
Property Value
Type |
---|
System.Drawing.Point |
DrawItemCallback
See DrawItemCallback.
Declaration
public DrawItemCallback DrawItemCallback { get; set; }
Property Value
Type |
---|
DrawItemCallback |
ForceDrawImage
Gets or sets to draw the image anyway.
Declaration
public bool ForceDrawImage { get; set; }
Property Value
Type |
---|
System.Boolean |
HitCloseButton
Gets or sets the value whether mouse is over the close button.
Declaration
public virtual bool HitCloseButton { get; set; }
Property Value
Type |
---|
System.Boolean |
HotTrack
Indicates whether hot tracking is on.
Declaration
public bool HotTrack { get; set; }
Property Value
Type |
---|
System.Boolean |
ImageRect
Gets or sets the image rectangle.
Declaration
public Rectangle ImageRect { get; set; }
Property Value
Type |
---|
System.Drawing.Rectangle |
LabelEditOffsetY
Returns y-coordinate offset for Label Edit control, in Tab's captions editable case.
Declaration
public virtual int LabelEditOffsetY { get; }
Property Value
Type |
---|
System.Int32 |
NeedRotateTextWhenVertical
Gets the whether the tabs need to rotate the text when aligned vertically.
Declaration
protected bool NeedRotateTextWhenVertical { get; }
Property Value
Type |
---|
System.Boolean |
ShouldDrawRotatedWhenVertical
Declaration
protected bool ShouldDrawRotatedWhenVertical { get; }
Property Value
Type |
---|
System.Boolean |
ShouldDrawText
Gets or sets a value indicating whether text should be drawn.
Declaration
public bool ShouldDrawText { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowCloseButton
Gets or sets the value whether close button should be visible for each tab.
Declaration
public bool ShowCloseButton { get; set; }
Property Value
Type |
---|
System.Boolean |
ShowCloseButtonBackColor
Gets or sets the value whether to show the close button back color when the mouse is hover on close button of Active Tab.
Declaration
public bool ShowCloseButtonBackColor { get; set; }
Property Value
Type |
---|
System.Boolean |
TabAlignment
Gets or sets the tab alignment. See TabAlignment.
Declaration
public TabAlignment TabAlignment { get; set; }
Property Value
Type |
---|
System.Windows.Forms.TabAlignment |
TabBorderColor
Indicates the border color of the tabs.
Declaration
public virtual Color TabBorderColor { get; }
Property Value
Type |
---|
System.Drawing.Color |
TabControl
Returns the parent ITabControl.
Declaration
public ITabControl TabControl { get; }
Property Value
Type |
---|
ITabControl |
TabData
Gets / sets the ITabData associated with this tab.
Declaration
public virtual ITabData TabData { get; set; }
Property Value
Type |
---|
ITabData |
TextBounds
Returns last drawn text bounds.
Declaration
public Rectangle TextBounds { get; }
Property Value
Type |
---|
System.Drawing.Rectangle |
Visible
Indicates whether this tab should be drawn visible.
Declaration
public virtual bool Visible { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
ApplyTransform(Graphics)
Rotates/scales the provided graphics object by an angle based on the current alignment such that you can use drawing code that assumes Top alignment for a tab.
Declaration
protected virtual void ApplyTransform(Graphics g)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The Graphics object to apply transformation on. |
Remarks
You should normally use this in the DrawInterior, DrawBackground, DrawBorders overrides to transform the incoming Graphics object. Use this in conjunction with the TabUtils.ApplyTransform to transform the incoming bounds of the above overrides.
CloseButtonHitTest(Point)
Checks, does CloseButton's bounds contain specified point.
Declaration
public virtual bool CloseButtonHitTest(Point pt)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | pt | Point to check. |
Returns
Type | Description |
---|---|
System.Boolean | true, if CloseButton's bounds contain specified point, otherwise - false. |
CorrectBounds(RectangleF)
Declaration
protected virtual RectangleF CorrectBounds(RectangleF bounds)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | bounds |
Returns
Type |
---|
System.Drawing.RectangleF |
CorrectInteriorBounds(RectangleF)
Declaration
protected virtual RectangleF CorrectInteriorBounds(RectangleF rectTextAndImage)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rectTextAndImage |
Returns
Type |
---|
System.Drawing.RectangleF |
CorrectPreferredSize(SizeF)
Returns the correct preferred size.
Declaration
protected virtual SizeF CorrectPreferredSize(SizeF preferredSize)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.SizeF | preferredSize | The Size of the Tab panel. |
Returns
Type | Description |
---|---|
System.Drawing.SizeF | The preferred size. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(Boolean)
Releases unmanaged and - optionally - managed resources
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
|
DrawBackground(DrawTabEventArgs)
Draws the background of the tab.
Declaration
protected abstract void DrawBackground(DrawTabEventArgs drawItemInfo)
Parameters
Type | Name | Description |
---|---|---|
DrawTabEventArgs | drawItemInfo | The object that has information regarding this tab and paint event. |
DrawBorders(DrawTabEventArgs)
Draws the borders of the tab.
Declaration
protected abstract void DrawBorders(DrawTabEventArgs drawItemInfo)
Parameters
Type | Name | Description |
---|---|---|
DrawTabEventArgs | drawItemInfo | The object that has information regarding this tab and paint event. |
DrawCloseButton(Graphics, RectangleF)
Draw the close button.
Declaration
protected virtual void DrawCloseButton(Graphics g, RectangleF closeButtonBounds)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The Graphics object to draw the close button. |
System.Drawing.RectangleF | closeButtonBounds | The close button bounds. |
DrawCloseButton(Graphics, RectangleF, DrawTabEventArgs)
Draws the close button.
Declaration
protected virtual void DrawCloseButton(Graphics g, RectangleF closeButtonBounds, DrawTabEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics object. |
System.Drawing.RectangleF | closeButtonBounds | The bounds of the close button. |
DrawTabEventArgs | e |
DrawFocusRect(Graphics, RectangleF, Color, Color)
Draws the focus rectangle in the specified rectangle.
Declaration
protected virtual void DrawFocusRect(Graphics g, RectangleF focusRect, Color fore, Color back)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics instance. |
System.Drawing.RectangleF | focusRect | The layout rectangle. |
System.Drawing.Color | fore | The forecolor with which to draw. |
System.Drawing.Color | back | The backcolor with which to draw. |
DrawInterior(DrawTabEventArgs)
Draws the interior of the tab.
Declaration
protected abstract void DrawInterior(DrawTabEventArgs drawItemInfo)
Parameters
Type | Name | Description |
---|---|---|
DrawTabEventArgs | drawItemInfo | The object that has information regarding this tab and paint event. |
DrawText(Graphics, RectangleF, String, StringFormat, DrawTabEventArgs)
Draws the text of the tab, given the context.
Declaration
protected virtual void DrawText(Graphics g, RectangleF rectText, string text, StringFormat format, DrawTabEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics instance. |
System.Drawing.RectangleF | rectText | The layout rectangle. |
System.String | text | The text to draw. |
System.Drawing.StringFormat | format | The System.Drawing.StringFormat with which to draw. |
DrawTabEventArgs | e | The object that has information regarding this tab and paint event. |
DrawTextAndImage(Graphics, RectangleF, DrawTabEventArgs)
Draws the text and image of the tab, given the context.
Declaration
protected virtual void DrawTextAndImage(Graphics g, RectangleF rectTextAndImage, DrawTabEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics instance. |
System.Drawing.RectangleF | rectTextAndImage | The layout rectangle. |
DrawTabEventArgs | e | The object that has information regarding this tab and paint event. |
Finalize()
Releases unmanaged resources and performs other cleanup operations before the TabRendererBase is reclaimed by garbage collection.
Declaration
protected void Finalize()
GetActiveForeColor()
Returns the forecolor with which to draw the tab text on active tab.
Declaration
protected virtual Color GetActiveForeColor()
Returns
Type | Description |
---|---|
System.Drawing.Color | Fore color. |
GetBoundsForScrolling()
Returns the current drawing bounds. Overrides in OneNoteStyleRenderer.
Declaration
public virtual RectangleF GetBoundsForScrolling()
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The bounds as a rectangle. |
Remarks
If this is the selected tab, then this method adds the overlapped size to the bounds returned by Bounds.
GetCloseButtonBounds(DrawTabEventArgs)
Gets the close button bounds.
Declaration
protected virtual RectangleF GetCloseButtonBounds(DrawTabEventArgs drawItemInfo)
Parameters
Type | Name | Description |
---|---|---|
DrawTabEventArgs | drawItemInfo |
Returns
Type |
---|
System.Drawing.RectangleF |
GetCurrentBounds()
Returns the current drawing bounds.
Declaration
public virtual RectangleF GetCurrentBounds()
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The bounds as a rectangle. |
Remarks
If this is the selected tab, then this method adds the overlapped size to the bounds returned by Bounds.
GetForeColor()
Returns the forecolor with which to draw the tab text.
Declaration
protected virtual Color GetForeColor()
Returns
Type | Description |
---|---|
System.Drawing.Color | Fore color. |
GetInteriorBounds(RectangleF, Boolean)
Gets the interior bounds
Declaration
protected virtual RectangleF GetInteriorBounds(RectangleF currentBounds, bool selectedTab)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | currentBounds | |
System.Boolean | selectedTab |
Returns
Type |
---|
System.Drawing.RectangleF |
GetItemPreferredSize(Graphics)
Declaration
protected virtual SizeF GetItemPreferredSize(Graphics g)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g |
Returns
Type |
---|
System.Drawing.SizeF |
GetOverlapSize(SizeF)
Returns the overlapped size, if any, of the tabs.
Declaration
public virtual SizeF GetOverlapSize(SizeF tabSize)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.SizeF | tabSize |
Returns
Type | Description |
---|---|
System.Drawing.SizeF | The overlap size. |
GetPreferredSize(Graphics)
Returns the preferred size for the tabs.
Declaration
public virtual SizeF GetPreferredSize(Graphics g)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g |
Returns
Type |
---|
System.Drawing.SizeF |
GetRedrawBounds()
See GetRedrawBounds().
Declaration
public virtual RectangleF GetRedrawBounds()
Returns
Type |
---|
System.Drawing.RectangleF |
GetTabFont(Boolean)
Declaration
protected Font GetTabFont(bool isInactive)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isInactive |
Returns
Type |
---|
System.Drawing.Font |
GetTextPosition(Graphics, String, Font, RectangleF, StringFormat)
Returns the position where the text should be drawn given a layout rectangle and the Graphics context.
Declaration
public virtual RectangleF GetTextPosition(Graphics g, string text, Font font, RectangleF rectLayout, StringFormat stringformat)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics instance. |
System.String | text | The text to draw. |
System.Drawing.Font | font | The font with which to draw. |
System.Drawing.RectangleF | rectLayout | The layout rectangle. |
System.Drawing.StringFormat | stringformat | The System.Drawing.StringFormat. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The position where the text should be drawn. |
HitTest(PointF)
Indicates whether the specified position is within the current bounds.
Declaration
public virtual bool HitTest(PointF mousePosition)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | mousePosition | The mouse position to test. |
Returns
Type | Description |
---|---|
System.Boolean | True if hit; false otherwise. |
IsHotLightState(DrawItemState)
Indicates the hotLight state of the item.
Declaration
protected virtual bool IsHotLightState(DrawItemState state)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.DrawItemState | state |
Returns
Type |
---|
System.Boolean |
IsSelectedState(DrawItemState)
Indicates the selected state of the item.
Declaration
protected virtual bool IsSelectedState(DrawItemState state)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.DrawItemState | state |
Returns
Type |
---|
System.Boolean |
IsTextShrunk()
Indicates whether the text is shrunk.
Declaration
public virtual bool IsTextShrunk()
Returns
Type |
---|
System.Boolean |
NeedMirroredBackground()
Indicates whether its needed to mirrored background.
Declaration
protected virtual bool NeedMirroredBackground()
Returns
Type |
---|
System.Boolean |
OnPaint(Graphics, Rectangle)
Paints the tab. See OnPaint(Graphics, Rectangle).
Declaration
public virtual void OnPaint(Graphics g, Rectangle clippingRect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics instance. |
System.Drawing.Rectangle | clippingRect | The clipping rectangle to use while drawing. |
RestoreGraphicsState(Graphics)
Restore the Graphics state.
Declaration
protected virtual void RestoreGraphicsState(Graphics g)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The Graphics object. |
SaveGraphicsState(Graphics, ref RectangleF)
Save the graphics state.
Declaration
protected virtual void SaveGraphicsState(Graphics g, ref RectangleF curBounds)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The Graphics object. |
System.Drawing.RectangleF | curBounds | The rectangle of the Tab Renderer. |
TabPropertyChanged()
See TabPropertyChanged().
Declaration
public virtual void TabPropertyChanged()