Page 1 of 1
RVRuler and VCL styles
Posted: Mon Apr 13, 2020 3:58 am
by Martian
Hi there,
Looks like RVRules doesn't support VCL styles.
What is the best way to assign correct style colors to it?
Re: RVRuler and VCL styles
Posted: Mon Apr 13, 2020 2:25 pm
by Sergey Tkachenko
The ruler support VCL style colors. I do not think that more complete VCL style support is possible.
- ruler-skin.png (53.55 KiB) Viewed 28106 times
Re: RVRuler and VCL styles
Posted: Tue Apr 14, 2020 9:53 am
by Sergey Tkachenko
1) Which version of TRichView do you use?
2) What's the value of Ruler.RulerColor property?
Re: RVRuler and VCL styles
Posted: Thu Apr 16, 2020 7:02 am
by Martian
1) 18.3
2) clWindow
Re: RVRuler and VCL styles
Posted: Thu Apr 16, 2020 8:44 am
by Sergey Tkachenko
VCL skins are completely supported if Ruler.SkinType = stNoSkin.
Your ruler has SkinType <> stNoSkin.
There is a way to improve skin supports in this mode.
In RVRulerBase.pas, change the procedure UpdateRulerColors:
Code: Select all
procedure TCustomRuler.UpdateRulerColors;
Begin
If FSkinType = stNoSkin then
Exit;
Move(DefRulerColors, FRulerColors, 40);
If ColorToRGB(GetSysColor(RulerColor)) <> clWhite then
ColorizeColorsAlter(FRulerColors, GetSysColor(RulerColor))
Else If FSkinType = stSkin2 then
ColorizeColorsAlter(FRulerColors, $00C0C0C0);
SaturationColors(FRulerColors, FRulSaturation);
end;
Make this procedure public in TCustomRuler. Call it when the application starts and after each change of VCL theme.
But look at this code. In skin modes, the ruler has a predefined set of gray colors that can be shaded using RulerColor, and only in stSkin1 mode.
After the change I suggested, the ruler look betters in dark themes. But still not very good in inverted (light on dark) color themes.
If this shading is OK for you, you can improve the result by assigning inverted font color for inverted themes:
Code: Select all
uses Themes, RVFuncs;
procedure TForm3.btnSkinClick(Sender: TObject);
begin
RVA_ChooseStyle;
RVRuler1.UpdateRulerColors;
if RV_GetLuminance(StyleServices.GetSystemColor(clWindowText)) >
RV_GetLuminance(StyleServices.GetSystemColor(clWindow)) then
RVRuler1.Font.Color := not StyleServices.GetSystemColor(clWindowText) and $FFFFFF
else
RVRuler1.Font.Color := clWindowText;
end;
But the best solution is to assign RVRuler.SkinType = stNoSkin in these themes.