我使用DevExpress DxRibbon
控件,当我将ColorSchemeName
属性更改为Seven
时,它不起作用,我的Ribbon样式始终为Blue
。为什么呢?
答案 0 :(得分:3)
老兄,我最近和Ribbon有同样的问题,我找到答案,你应该只包括 dxSkinsdxRibbonPainter 单元并且很有趣。
我很久以前就注意到Embarcadero和合作伙伴缺乏关于他们产品的更多信息,这也是许多其他人为什么Delphi可悲地拥有一点市场份额的原因之一。示例:与PHP或Rubby相比,您发现Delphi,RADPHP或Prisma有多少本书?
答案 1 :(得分:1)
首先确保dxSkinsdxBarPainter位于uses子句中。但可能最重要的一点是确保适当的皮肤单位在uses子句中 - 在本例中为dxSkinSeven。然后只需设置ColorSchemeName属性。据我所知,Seven无论如何只是一个简单的蓝色版本 - 所以你确定它实际上没有改变?
修改强> 好的 - 样本:
创建一个新的VCL表单项目。在form1的代码中替换为以下内容:
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.
正如他们所说,对我有用。