We've been getting (lots) of complaints from our users about the lack of form frames in the dark color schemes of the The Bezier skin.
The problem, as you probably know, is that, for some skin palettes, the fact that the form caption bar, form background, and frame have the same color makes overlapping forms blend together.
Here's what forms using the Default palette looks like (in the skin editor):
That's okay, but then look at something like Ghost Shark:
And it's the same for most of the dark skins, save a couple.
I don't know what your designers were thinking when they implemented this but it's clearly not usable.
Since this has been a known problem since the skin was introduced you clearly aren't going to fix it in the skin. We could fix it ourselves with the skin editor but that would mean that we would have to reapply these changes every time we update the library. We've been down that path before and it's just not a maintainable solution.
So in order to fix the problem, without modifying the skin files, we decided to fix it at runtime, in code:
Delphi// Patch the skin (we assume it's Bezier) to show a thin border around the form and captionbar
RootLookAndFeel.BeginUpdate;
try
var PainterInfo: TdxSkinLookAndFeelPainterInfo;
if (RootLookAndFeel.Painter.GetPainterData(PainterInfo)) then
begin
var Group: TdxSkinControlGroup;
var CaptionElement: TdxSkinElement := nil;
if PainterInfo.Skin.GetGroupByName('Form', Group) then
if not Group.GetElementByName('FormCaption', CaptionElement) then
CaptionElement := nil;
for var Border := Low(TcxBorder) to High(TcxBorder) do
begin
// The caption bar frame
if (CaptionElement <> nil) and (CaptionElement.Borders[Border].Color = clNone) then
begin
// left and right caption bar border (top doesn't appear to be used)
if (Border <> bBottom) then
CaptionElement.Borders[Border].ColorReference := 'Brush Light'
else
// Bottom caption bar border
CaptionElement.Borders[bBottom].ColorReference := 'Brush Minor';
end;
// The form frame; Top caption bar border, left, right, and bottom form border
// BorderStyle = bsToolWindow or bsSizeToolWin
if (PainterInfo.FormFrames[False, Border].Borders[Border].Color = clNone) then
PainterInfo.FormFrames[False, Border].Borders[Border].ColorReference := 'Brush Light';
// everything else
if (PainterInfo.FormFrames[True, Border].Borders[Border].Color = clNone) then
PainterInfo.FormFrames[True, Border].Borders[Border].ColorReference := 'Brush Light';
end;
end;
RootLookAndFeel.Refresh;
finally
RootLookAndFeel.EndUpdate;
end;
This appear to solve the problem for regular forms:
… but for tool windows we have been unable to modify the left, right, and bottom caption bar border:
I suspect that the test of the color against clNone
should really be testing the palette Key Paint color against the Paint color because all the palettes have a frame color of clNone
. Even those that already have a border.
So the question is: How do we go about ensuring that a given palette always produce a visible form border?
Ah… Yes, of course.
For some reason I didn't think of using
GetElementByName
to style the tool window caption bar, like I did with the regular form caption bar. Silly me.Thank you for the help.