I did a quick experiment with tabsheet background and applied the same changes to tnxTabSheet that what we just did for tnxHeaderpanel:
1- Create a new variable FPageStyle (to be consistent with the other fPagexxxxx)
2- create a property PageStyle:
property PageStyle: TNxPanelStyle read FPageStyle write SetPageStyle default ptDefault;
3- Create a setter procedure
procedure TNxTabSheet.SetPageStyle(const Value: TNxPanelStyle);
begin
FPageStyle := Value;
Invalidate;
end;
4- modify the paint procedure as follows
comment out the following two lines
// Brush.Color := Self.Color;
// FillRect(ClientRect);
and replace them with (taken out of tnxheader.drawBackground)
case FPageStyle of
ptDefault:
with Canvas do
begin
Brush.Color := Self.Color;
FillRect(ClientRect);
end;
ptGradient:
begin
SecondColor := SchemeColor(seBtnFace);
DrawVertGradient(Canvas, ClientRect, clWindow, SecondColor);
end;
ptInverseGradient:
begin
SecondColor := SchemeColor(seBtnFace);
DrawVertGradient(Canvas, ClientRect, SecondColor, clWindow);
end;
end;
et voilĂ , a nice nxPage with gradient capabilities; using the current scheme color. It saves, in my case the need to have a nxheaderpanel on each page to achieve this effect and should not cause any compatibilities issues for exisitng users.
Please tell me if you accept this change.
tNxTabSheet
Started by didiergm, Dec 31 2010 11:47 AM
3 replies to this topic
#1
Posted 31 December 2010 - 11:47 AM
#2
Posted 31 December 2010 - 08:43 PM
Hello Didier,
I have add it. It will be included in next release. Thank you.
Best regards
I have add it. It will be included in next release. Thank you.
Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#3
Posted 31 December 2010 - 08:46 PM
Update:
I have only changed clWindow to Color:
This made a possibility to set a color for gradient instead hardcoding to clWindow.
best regards
I have only changed clWindow to Color:
CODE
procedure TNxTabSheet.Paint;
var
r: TRect;
SecondColor: TColor;
begin
inherited;
with Canvas do
begin
case FPageStyle of
ptDefault:
begin
Brush.Color := Self.Color;
FillRect(ClientRect);
end;
ptGradient:
begin
SecondColor := SchemeColor(seBtnFace);
DrawVertGradient(Canvas, ClientRect, Color, SecondColor);
end;
ptInverseGradient:
begin
SecondColor := SchemeColor(seBtnFace);
DrawVertGradient(Canvas, ClientRect, SecondColor, Color);
end;
end;
if (csDesigning in ComponentState) then
begin
if Margin > 0 then
begin
Pen.Color := clGrayText;
Pen.Style := psDot;
Brush.Style := bsClear;
r := ClientRect;
InflateRect(r, -Margin + 1, -Margin + 1);
Rectangle(r);
Pen.Style := psSolid;
Brush.Style := Graphics.bsSolid;
end;
end;
end;
DoPaint;
end;
var
r: TRect;
SecondColor: TColor;
begin
inherited;
with Canvas do
begin
case FPageStyle of
ptDefault:
begin
Brush.Color := Self.Color;
FillRect(ClientRect);
end;
ptGradient:
begin
SecondColor := SchemeColor(seBtnFace);
DrawVertGradient(Canvas, ClientRect, Color, SecondColor);
end;
ptInverseGradient:
begin
SecondColor := SchemeColor(seBtnFace);
DrawVertGradient(Canvas, ClientRect, SecondColor, Color);
end;
end;
if (csDesigning in ComponentState) then
begin
if Margin > 0 then
begin
Pen.Color := clGrayText;
Pen.Style := psDot;
Brush.Style := bsClear;
r := ClientRect;
InflateRect(r, -Margin + 1, -Margin + 1);
Rectangle(r);
Pen.Style := psSolid;
Brush.Style := Graphics.bsSolid;
end;
end;
end;
DoPaint;
end;
This made a possibility to set a color for gradient instead hardcoding to clWindow.
best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#4
Posted 31 December 2010 - 10:31 PM
QUOTE (Boki (Berg) @ Dec 31 2010, 08:46 PM) <{POST_SNAPBACK}>
Update:
....
I have only changed clWindow to Color:
This made a possibility to set a color for gradient instead hardcoding to clWindow.
best regards
....
I have only changed clWindow to Color:
This made a possibility to set a color for gradient instead hardcoding to clWindow.
best regards
Even better!
Regards
Didier
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users