TabBar whose style can be changed dynamically based on JvTabBar

寵の児 提交于 2019-12-13 03:56:08

问题


I have tried many different libraries, but none came. None of them can not be specified without introducing his own style in Painter. I need to be able to quickly and dynamically change the style tab.

In response, I showed my developments.

If someone has similar developments - write them in response.


回答1:


I decided to upgrade the simplest of them: TJvTabBar of JVCL (latest revision: 13415)

Here is the result.

Before (default)

After

Style sources (All graphics imported from png files with transparency)

Easy apply any personal style to any JvTabBar

var tmp:TStrings;
begin    
  tmp:=TStringList.Create;
  tmp.Values['TOP_background']:=                ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_background.png';
  tmp.Values['TOP_active_left_side']:=          ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_active_left_side.png';
  tmp.Values['TOP_active_right_side']:=         ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_active_right_side.png';
  tmp.Values['TOP_active_center']:=             ExtractFileDir(Application.ExeName)+'\skins\default\tabs-TOP_active_center.png';

  tmp.Values['BOTTOM_background']:=             ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_background.png';
  tmp.Values['BOTTOM_active_left_side']:=       ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_active_left_side.png';
  tmp.Values['BOTTOM_active_right_side']:=      ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_active_right_side.png';
  tmp.Values['BOTTOM_active_center']:=          ExtractFileDir(Application.ExeName)+'\skins\default\tabs-BOTTOM_active_center.png';

  tmp.Values['CLOSEBUTTON_normal']:=            ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_normal.png';
  tmp.Values['CLOSEBUTTON_selected']:=          ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_selected.png';
  tmp.Values['CLOSEBUTTON_disabled']:=          ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_disabled.png';
  tmp.Values['CLOSEBUTTON_closing']:=           ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_closing.png';
  tmp.Values['CLOSEBUTTON_modified']:=          ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_modified.png';
  tmp.Values['CLOSEBUTTON_closing_modified']:=  ExtractFileDir(Application.ExeName)+'\skins\default\tabs-CLOSEBUTTON_closing_modified.png';

  JvTabBar1.StyleImages:=tmp;

  tmp.Values['BOTTOM_background']:=             ExtractFileDir(Application.ExeName)+'\skins\default\MYMOD_tabs-BOTTOM_background.png';

  JvTabBar2.StyleImages:=tmp;

Main changes

  • Added ability to specify their own style ( JvTabBar1.StyleImages )
  • Added the ability to move the close button to the right ( JvTabBar1.CloseButtonRight: = true or false )
  • Many fixes to the size and position of text / icons / buttons / scroll

My JvTabBar.pas mod You can download it here http://pastebin.com/JmbufHy0

And example source style + JvTabBar.pas http://www.sendspace.com/file/shhuzr



来源:https://stackoverflow.com/questions/21972494/tabbar-whose-style-can-be-changed-dynamically-based-on-jvtabbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!