Kermia
Kermia

Reputation: 4221

How to set the ColorSchemeName property for DevExpress Ribbon?

I use DevExpress DxRibbon control and when i change the ColorSchemeName property to Seven, it doesn't work and my Ribbon style is always Blue. why?

Upvotes: 0

Views: 3971

Answers (2)

Dude, I recently had the same problem with Ribbon, and I found the answer, you should include dxSkinsdxRibbonPainter unit only and fun.

I've noted since long time ago that Embarcadero and partners lack for more information about their products, that's one reason among many others why Delphi sadly has a little market-share. Example: How many books you find about Delphi, RADPHP, or Prisma, compared to PHP or Rubby?

Upvotes: 3

shunty
shunty

Reputation: 3758

First make sure that dxSkinsdxBarPainter is in the uses clause. But probably the most important bit is to make sure that the appropriate skin unit is in the uses clause - in this case dxSkinSeven. Then just set the ColorSchemeName property. As far as I can see Seven is only a light version of Blue anyway - so you are sure it hasn't actually changed?

Edit: OK - a sample:

Create a new VCL forms project. In the code for form1 replace with the following:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  dxSkinsCore, dxSkinBlue, dxSkinCaramel, dxSkinDarkRoom, dxSkinFoggy,
  dxSkiniMaginary, dxSkinLilian, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver,
  dxSkinSeven, dxSkinSharp, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
  dxSkinXmas2008Blue, dxSkinsdxRibbonPainter, dxStatusBar, dxRibbonStatusBar,
  cxClasses, dxRibbon, dxSkinsdxBarPainter, dxBar;

type
  TForm1 = class(TForm)
  private
    ribbon1: TdxRibbon;
    tab1: TdxRibbonTab;

    barManager1: TdxBarManager;
    bar1: TdxBar;
    btn1: TdxBarButton;
    btn2: TdxBarButton;
    btn3: TdxBarButton;

    procedure SetupBarManager;
    procedure SetupRibbon;
    procedure dxBarButtonClick(Sender: TObject);
  protected
    procedure Loaded; override;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Loaded;
begin
  inherited;

  SetupBarManager;
  SetupRibbon;
end;

procedure TForm1.SetupBarManager;
begin
  barManager1 := TdxBarManager.Create(Self);
  btn1 := TdxBarButton.Create(Self);
  btn2 := TdxBarButton.Create(Self);
  btn3 := TdxBarButton.Create(Self);

  with barManager1 do
  begin
    Name := 'barManager1';
    Categories.Clear;
    Categories.Add('Default');
  end;

  bar1 := barManager1.Bars.Add;
  with bar1 do begin
    Name := 'bar1';
    Visible := True;
    with ItemLinks.Add do
    begin
      Visible := True;
      Item := btn1;
    end;
    with ItemLinks.Add do
    begin
      Visible := True;
      Item := btn2;
    end;
    with ItemLinks.Add do begin
      Visible := True;
      Item := btn3;
    end;
  end;

  with btn1 do begin
    Name := 'btn1';
    Caption := 'Seven';
    Category := 0;
    Visible := ivAlways;
    OnClick := dxBarButtonClick;
  end;
  with btn2 do begin
    Name := 'btn2';
    Caption := 'Springtime';
    Category := 0;
    Visible := ivAlways;
    OnClick := dxBarButtonClick;
  end;
  with btn3 do begin
    Name := 'btn3';
    Caption := 'Blue';
    Category := 0;
    Visible := ivAlways;
    OnClick := dxBarButtonClick;
  end;
end;

procedure TForm1.SetupRibbon;
begin
  ribbon1 := TdxRibbon.Create(Self);

  with ribbon1 do begin
    Name := 'ribbon';
    Parent := Self;
    Left := 0;
    Top := 0;
    Height := 150;
    BarManager := barManager1;
    ColorSchemeName := 'Lilian';
    TabOrder := 0;
    TabStop := False;
  end;

  tab1 := ribbon1.Tabs.Add;
  with tab1 do begin
    Name := 'tab1';
    Ribbon := ribbon1;
    Visible := true;
  end;
  tab1.AddToolBar(bar1);
end;

procedure TForm1.dxBarButtonClick(Sender: TObject);
begin
  if (Sender is TdxBarButton) then
    ribbon1.ColorSchemeName := TdxBarButton(Sender).Caption;
end;

end.

Works for me, as they say.

Upvotes: 1

Related Questions