HX_unbanned
HX_unbanned

Reputation: 597

Use TStatusBar style and graphical effects within TTabSet control

OS: Windows XP Pro SP3

Issue:

Sorry for small image. Click to enlarge.

As you see - in left side is located StatusBar Control ; In right side - TabSet Control.

What approach you would suggest to "copy" StatusBar style ( dynamic darkening of Top and Button ) into TabSet Control? Colour manipulations like clNone or AlphaBlend do not work ... and TransparentColor prop is not available either ...

Again I am too puzzled because there is a lot of options ( imho ) to choose from, but I do not know possible side-effects and level of compatibility in various Windows versions.

Thank you very very very much for any help.

P.S. Sorry if it is hard to notice issue I am experiencing in my little image above, BUT if I would resize it, It would lose quality and there might be problems notice anything at all ..


Rephrasing the Question

StatusBar1 is Parent of TabSet1. Now it looks like this ( wrong ):

alt text

I must achieve this StatusBar1.Panels[0] and TabSet1 look ( correct ):

https://i.sstatic.net/gd9r9.png


I also tried to use psOwnerDraw technique ( http://delphi.about.com/od/vclusing/a/statusbar_owner.htm ) for StatusBar1.Panels[0] and get this result:

alt text

Upvotes: 0

Views: 859

Answers (2)

Uli Gerhardt
Uli Gerhardt

Reputation: 13991

I tried the following in Turbo Delphi:

  • Create a new VCL app.
  • Drop a TStatusBar and a TTabSet on the form.
  • Add the following OnCreate handler:

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      StatusBar1.SimplePanel := True;
      StatusBar1.SimpleText := 'Hallo';
      TabSet1.Tabs.Add('Code');
      TabSet1.Tabs.Add('History');
      TabSet1.SetBounds(30, 0, TabSet1.Width, StatusBar1.Height); // Replace the 204
      TabSet1.ParentBackground := True;
      TabSet1.SoftTop := True;
      TabSet1.Style := tsSoftTabs;
      TabSet1.Parent := StatusBar1;
    end;
    
  • Add XPMan to Unit1's uses clause.

  • Run the app under XP. This gives me the following form:alt text

Is this what you want?

Upvotes: 3

Warren  P
Warren P

Reputation: 68862

You have two basic ways to accomplish this:

  1. Do it the way that the control you're copying does it, which means, invoke the XP Theming engine. You should be aware if you do it this way, that this effect is conditional, and only shown on systems that (a) support and (b) have themes enabled, so any user who has chosen the Windows Classic Theme (Windows 2000 era look and feel) will not see it.

  2. Write some code to do the effects yourself. In this case, a bitmap that is carefully painted into a region on top of an owner-drawn tab. This will give you a consistent application look, but will be ignoring the users perhaps-intentional-perhaps-unintentional preferences on how the application should look.

Obviously there are tradeoffs in both approaches.

Upvotes: 0

Related Questions