XP Tab Control 1.0.1
http://www.dihav.com/
By Mohammad Yousefi
vahid_you2004@yahoo.com
April 2013
- This component is freeware and can be distributed by everyone.
- No person or company may charge a fee for the distribution of this product.
- No warranty of any kind is expressed or implied. You use at your own risk. The author will not be liable for data loss, damages, loss of profits or any other kind of loss while using or misusing this component.
- You may not rent, lease, sell, modify, and decompile component. Any such unauthorized use shall result in immediate and automatic termination of this license and may result in criminal and/or civil prosecution.
Installing and using this component signifies acceptance of these terms and conditions of the license.
Top
This component is a type of Tab Control with different appearance.
It works completely like standard tab controls.
This component is tested on "Delphi 7" and "Delphi XE2".
Top
- Run Delphi.
- Create a new package or open an existing package.
- Add "MCoPXPTabControl.pas", "MCoPXPTabControlReg.pas" and "CompIcon.dcr" files to the package.
- Save, compile and install the package.
- Component will be appeared on "dihav" tab in "Component Palette".
- Add component files directory to "Library Path" accessible from "Tools>Environment Options...>Library" or "Tools>Options...>Environment Options>Delphi Options>Library - Win32".
Top
- EMCoPXPTabError = Exception;
- TMCoPXPTabGradientDirection = (gdHorizontal, gdVertical);
- TMCoPXPTabButtonsPosition = (bpAbove, bpBelow, bpLeft, bpRight);
- TMCoPXPTabArrowDirection = (adUp, adDown, adLeft, adRight);
- TMCoPXPTabButtonState = (bsNormal, bsOver, bsPressed);
- TMCoPXPTabColorScheme = (csWindows, csBlue, csOlive, csSilver, csSky, csBlack, csOrange, csPurple, csGreen, csRed, csCustom);
- TMCoPXPTabOnDrawArrow = procedure (Sender : TObject; ACanvas : TCanvas; ARect : TRect; ADirection : TMCoPXPTabArrowDirection; AState : TMCoPXPTabButtonState) of object;
The arrow must be drawn in the ARect on the ACanvas in direction of ADirection at state of AState.
- TMCoPXPTabOnDrawCloseButton = procedure (Sender : TObject; ACanvas : TCanvas; ALeft, ATop : Integer; AState : TMCoPXPTabButtonState; AFocused : Boolean) of object;
The button must be drawn at position ALeft and ATop on the ACanvas at state of AState.
If the button is focused the AFocused parameter is true.
- TMCoPXPTabOnMeasureArrow = procedure(Sender : TObject; var ASize : Integer) of object;
The ASize specifies the arrow size.
- TMCoPXPTabOnMeasureCloseButton = procedure (Sender : TObject; var AWidth, AHeight : Integer) of object;
The AWidth and AHeight specify the close button size.
- TMCoPXPTabOnCloseTab = procedure (Sender : TObject; ATab : TMCoPXPTabSheet; ATabIndex : Integer) of object;
ATab is the TabSheet sould be closed and ATabIndex is its index.
- TMCoPXPTabChanging = procedure (Sender : TObject; var AllowChange : Boolean) of object;
Set the AllowChange parameter to false to prevent the change.
- TMCoPXPTabSheet = class(TWinControl)
- TMCoPXPTabControl = class(TCustomControl)
The sheets object.
- const
MCoPTabNone = -1;
MCoPTabPreviousButton = -2;
MCoPTabNextButton = -3;
MCoPTabCloseButton = -4;
Top
TMCoPXPTabControl
- ActiveTab : TMCoPXPTabSheet
Specifies the tab currently displayed by the tab control.
- ArrowColor : TColor
Determinates the color of the arrows.
- BackColor1 : TColor
Determinates the first color of the background gradient.
- BackColor2 : TColor
Determinates the second color of the background gradient.
- BackgroundGradientDirection : TMCoPXPTabGradientDirection
Determinates the direction of the background gradient.
- BoxColor1 : TColor
Determinates the first color of the sheets gradient.
- BoxColor2 : TColor
Determinates the second color of the sheets gradient.
- CloseButtonNormalPosition : Integer
Specifies the normal position of the close button.
- CloseButtonTangentialPosition : Integer
Specifies the tangential position of the close button.
- CloseButtonColor : TColor
Determinates the color of the close button.
- ColorScheme : TMCoPXPTabColorScheme
Determinates the color scheme of the control.
You can define custom colors when this property set to csCustom.
- CustomArrow : Boolean
Specifies whether default arrow drawn.
If this property is set to true, when the arrow needed to be drawn the OnMeasureArrow event will be occurred to determine arrow size, then the OnDrawArrow event will be occurred to draw custom arrow.
- CustomClose : Boolean
Specifies whether default close button drawn.
If this property is set to true, when the button needed to be drawn the OnMeasureCloseButton event will be occurred to determine button size, then the OnDrawCloseButton event will be occurred to draw custom button.
- DrawCloseButton : Boolean
Specifies whether the close button drawn on tabs.
- FocusLineColor : TColor
Determinates the color of the focus line.
- Images : TCustomImageList
Specifies the images drawn in tabs.
- ImageNormalPosition : Integer
Specifies the normal position of the images.
- ImageTangentialPosition : Integer
Specifies the tangential position of the images.
- MarginBottom : Cardinal
Specifies the bottom margin of the sheets.
- MarginLeft : Cardinal
Specifies the left margin of the sheets.
- MarginRight : Cardinal
Specifies the right margin of the sheets.
- MarginTop : Cardinal
Specifies the top margin of the sheets.
- MouseOnTab : Integer (Read Only)
Indicates the mouse cursor position.
If the value is positive, property indicates tab index.
If the value is negative, property indicates special buttons.
- NextButtonVisible : Boolean (Read Only)
Indicates whether the scroll next button is shown.
- PreviousButtonVisible : Boolean (Read Only)
Indicates whether the scroll previous button is shown.
- OverColor : TColor
Determinates the color of the tabs when the mouse is over them.
- RotateTabs : Boolean
Determinates whether tab buttons rotated.
The tabs rotates only when the TabsPosition property is bpLeft or bpRight.
- RTLReading : Boolean
Layout in right to left reading order for bi-directional text when the font selected is a Hebrew or Arabic font.
- ScrollMax : Cardinal (Read Only)
Indicates the maximum value of the tabs scroll.
- ScrollPosition : Cardinal (Runtime)
Specifies the position of the tabs scroll.
- SheetRect : TRect (Read Only)
Indicates the sheets bounding rectangle on the tab control.
- TabCount : Cardinal (Read Only)
Indicates the number of tabs.
- TabIndex : Integer
Specifies the tab index currently displayed by the tab control.
- TabRect [Index : Cardinal] : TRect (Read Only)
Returns the bounding rectangle for a specified tab.
- TabSheet [Index : Cardinal] : TMCoPXPTabSheet (Runtime)
Returns the sheet of specified tab.
- TabsHeight : Cardinal
Specifies the height, in pixels, of the tabs in the tab control.
- TabsPosition : TMCoPXPTabButtonsPosition
Determines whether tabs appear at the top, bottom, left, or right.
- TabsWidth : Cardinal
Specifies the width, in pixels, of the tabs in the tab control.
- TextMarginBottom : Integer
Determines tab text margin from the bottom of the tab.
- TextMarginLeft : Integer
Determines tab text margin from the left of the tab.
- TextMarginRight : Integer
Determines tab text margin from the right of the tab.
- TextMarginTop : Integer
Determines tab text margin from the top of the tab.
- VisibleTabsCount : Cardinal (Read Only)
Contains the number of tabs currently visible in the tab set control.
The other properties are the same as TCustomControl.
TMCoPXPTabSheet
- Caption : String
Specifies the tab caption.
- ImageIndex : TImageIndex
Specifies the tab image index.
- PageIndex : Integer
Indicates the index of the tab sheet in the list of tab sheets maintained by the tab control.
- ShowIndex : Integer (Read Only)
Indicates the position of the tab sheet in the set of visible tabs in a tab control.
- TabControl : TMCoPXPTabControl (Runtime)
Indicates the tab control object that contains the tab sheet.
- TabVisible : Boolean
Specifies whether the tab appears in its tab control.
The other properties are the same as TWinControl.
Top
TMCoPXPTabControl
- procedure EnterActivationCode(Name, Code : String);
Removes the unregistered message from the control if the correct name and code is given.
- procedure RedrawControl;
Forces the control to redraw itself and all its sheets.
The other methods are the same as TCustomControl.
TMCoPXPTabSheet
- procedure HideTab;
Makes sheet invisible in its tab control.
- procedure ShowTab;
Makes sheet visible in its tab control.
The other methods are the same as TWinControl.
Top
TMCoPXPTabControl
The other events are the same as TCustomControl.
TMCoPXPTabSheet
- OnClose : TNotifyEvent
Occurs when the close button clicked.
- OnHide : TNotifyEvent
Occurs when the TabVisible property changes to false.
- OnShow : TNotifyEvent
Occurs when the TabVisible property changes to true.
The other events are the same as TWinControl.
Top
TMCoPXPTabControl supports following windows tab control messages:
- TCM_ADJUSTRECT
- TCM_DELETEALLITEMS
- TCM_DELETEITEM
- TCM_GETCURFOCUS
- TCM_GETCURSEL
- TCM_GETIMAGELIST
- TCM_GETITEM
- TCM_GETITEMCOUNT
- TCM_GETITEMRECT
- TCM_GETROWCOUNT
- TCM_HITTEST
- TCM_INSERTITEM
- TCM_REMOVEIMAGE
- TCM_SETCURFOCUS
- TCM_SETCURSEL
- TCM_SETIMAGELIST
- TCM_SETITEM
- TCM_SETITEMSIZE
Top
Visit dihav website.