How to change the color of active TAB in a TabControl (on FireMonkey) as shown below?
Set the tab control to transparent. Behind the tab, place a non-transparent box. Then in the OnChange event of the tab, change the background color of the box behind the tab.
The user selects a page by clicking the page's tab that appears at the top of the control. To add a new page to a TPageControl object at design time, right-click the TPageControl object and choose New Page. To create a tabbed control that uses only a single body portion (page), use TTabControl instead.
There are 2 ways to make this happen.
1) First option is you can create CustomStyle for TabControl from TStyleBook (Style Designer).
Then you can add whatever you want to use in your custom design (TRectangle is recommmended for many shape and colors).
2) I prefer to use second way for it. Set the TTabControl's TabPosition to None, then add a TGridPanelLayout to where you want to add tabs in your form. After that, set your TGridPanelLayout's column count for your tab count.
Now you need to know that your each tab box should be same. Drop a TRectangle for first column then set Align to Client (All colors and inner components are depends on your choice).
Be sure that your TRectangle components HitTest parameter is true and inner components' HitTest parameter is false.
Also you can handle your tab selections from OnClick event. Set each TRectangle (for tab) a Tag then connect all tabs to same OnClick event. Then you get Sender's Tag and set your TabControl1.ActiveTab from your Tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With