jvcllaz: Make JvTabBar support the high-res imagelist. Add AutoSize.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6366 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-05-01 22:38:49 +00:00
parent 493e1b50b8
commit a4e69c5dbf
2 changed files with 176 additions and 47 deletions

View File

@ -67,6 +67,7 @@ object Form1: TForm1
Top = 65 Top = 65
Width = 614 Width = 614
Align = alClient Align = alClient
BorderStyle = bsNone
Font.CharSet = ANSI_CHARSET Font.CharSet = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11

View File

@ -61,7 +61,6 @@ type
TJvTabBarItem = class(TCollectionItem) TJvTabBarItem = class(TCollectionItem)
private private
FLeft: Integer; // used for calculating DisplayRect FLeft: Integer; // used for calculating DisplayRect
FImageIndex: TImageIndex; FImageIndex: TImageIndex;
FEnabled: Boolean; FEnabled: Boolean;
FVisible: Boolean; FVisible: Boolean;
@ -151,16 +150,20 @@ type
protected protected
procedure Changed; virtual; procedure Changed; virtual;
procedure DrawBackground(Canvas: TCanvas; TabBar: TJvCustomTabBar; R: TRect); virtual; abstract; procedure DrawBackground(Canvas: TCanvas; TabBar: TJvCustomTabBar; R: TRect); virtual; abstract;
procedure DrawTab(Canvas: TCanvas; Tab: TJvTabBarItem; R: TRect); virtual; abstract;
procedure DrawDivider(Canvas: TCanvas; LeftTab: TJvTabBarItem; R: TRect); virtual; abstract; procedure DrawDivider(Canvas: TCanvas; LeftTab: TJvTabBarItem; R: TRect); virtual; abstract;
procedure DrawMoveDivider(Canvas: TCanvas; Tab: TJvTabBarItem; MoveLeft: Boolean); virtual; abstract; procedure DrawMoveDivider(Canvas: TCanvas; Tab: TJvTabBarItem; MoveLeft: Boolean); virtual; abstract;
function GetDividerWidth(Canvas: TCanvas; LeftTab: TJvTabBarItem): Integer; virtual; abstract;
function GetTabSize(Canvas: TCanvas; Tab: TJvTabBarItem): TSize; virtual; abstract;
function GetCloseRect(Canvas: TCanvas; Tab: TJvTabBarItem; R: TRect): TRect; virtual; abstract;
function Options: TJvTabBarPainterOptions; virtual; abstract;
procedure DrawScrollButton(Canvas: TCanvas; TabBar: TJvCustomTabBar; Button: TJvTabBarScrollButtonKind; procedure DrawScrollButton(Canvas: TCanvas; TabBar: TJvCustomTabBar; Button: TJvTabBarScrollButtonKind;
State: TJvTabBarScrollButtonState; R: TRect); virtual; State: TJvTabBarScrollButtonState; R: TRect); virtual;
procedure DrawTab(Canvas: TCanvas; Tab: TJvTabBarItem; R: TRect); virtual; abstract;
function GetCloseRect(Canvas: TCanvas; Tab: TJvTabBarItem; R: TRect): TRect; virtual; abstract;
function GetDividerWidth(Canvas: TCanvas; LeftTab: TJvTabBarItem): Integer; virtual; abstract;
function GetPixelsPerInch: Integer; virtual; abstract;
function GetRealImageSize(ATab: TJvTabBarItem): TSize;
procedure GetScrollButtons(TabBar: TJvCustomTabBar; var LeftButton, RightButton: TRect); {virtual; reserved for future use } procedure GetScrollButtons(TabBar: TJvCustomTabBar; var LeftButton, RightButton: TRect); {virtual; reserved for future use }
function GetTabBar(ATab: TJvTabBarItem): TJvCustomTabBar;
function GetTabSize(Canvas: TCanvas; Tab: TJvTabBarItem): TSize; virtual; abstract;
function Options: TJvTabBarPainterOptions; virtual; abstract;
function Scale96(AValue: Integer): Integer;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -211,9 +214,9 @@ type
procedure DrawTab(Canvas: TCanvas; Tab: TJvTabBarItem; ATabRect: TRect); override; procedure DrawTab(Canvas: TCanvas; Tab: TJvTabBarItem; ATabRect: TRect); override;
function GetCloseRect(Canvas: TCanvas; Tab: TJvTabBarItem; ATabRect: TRect): TRect; override; function GetCloseRect(Canvas: TCanvas; Tab: TJvTabBarItem; ATabRect: TRect): TRect; override;
function GetDividerWidth(Canvas: TCanvas; LeftTab: TJvTabBarItem): Integer; override; function GetDividerWidth(Canvas: TCanvas; LeftTab: TJvTabBarItem): Integer; override;
function GetPixelsPerInch: Integer; override;
function GetTabSize(Canvas: TCanvas; Tab: TJvTabBarItem): TSize; override; function GetTabSize(Canvas: TCanvas; Tab: TJvTabBarItem): TSize; override;
function Options: TJvTabBarPainterOptions; override; function Options: TJvTabBarPainterOptions; override;
function Scale96(AValue: Integer): Integer;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -233,7 +236,6 @@ type
property DividerColor: TColor read FDividerColor write SetDividerColor default $99A8AC; property DividerColor: TColor read FDividerColor write SetDividerColor default $99A8AC;
property MoveDividerColor: TColor read FMoveDividerColor write FMoveDividerColor default clBlack; property MoveDividerColor: TColor read FMoveDividerColor write FMoveDividerColor default clBlack;
property TabWidth: Integer read FTabWidth write SetTabWidth default 0; property TabWidth: Integer read FTabWidth write SetTabWidth default 0;
property Font: TFont read FFont write SetFont; property Font: TFont read FFont write SetFont;
property DisabledFont: TFont read FDisabledFont write SetDisabledFont; property DisabledFont: TFont read FDisabledFont write SetDisabledFont;
property SelectedFont: TFont read FSelectedFont write SetSelectedFont; property SelectedFont: TFont read FSelectedFont write SetSelectedFont;
@ -261,6 +263,7 @@ type
FCloseButton: Boolean; FCloseButton: Boolean;
FRightClickSelect: Boolean; FRightClickSelect: Boolean;
FImages: TCustomImageList; FImages: TCustomImageList;
FImagesWidth: Integer;
FHotTracking: Boolean; FHotTracking: Boolean;
FHotTab: TJvTabBarItem; FHotTab: TJvTabBarItem;
FSelectedTab: TJvTabBarItem; FSelectedTab: TJvTabBarItem;
@ -300,6 +303,7 @@ type
FScrollRepeatedClicked: Boolean; FScrollRepeatedClicked: Boolean;
FOnLeftTabChange: TNotifyEvent; FOnLeftTabChange: TNotifyEvent;
function GetHeight: Integer;
function GetLeftTab: TJvTabBarItem; function GetLeftTab: TJvTabBarItem;
procedure SetLeftTab(Value: TJvTabBarItem); procedure SetLeftTab(Value: TJvTabBarItem);
procedure SetSelectedTab(Value: TJvTabBarItem); procedure SetSelectedTab(Value: TJvTabBarItem);
@ -308,7 +312,6 @@ type
procedure SetImages(Value: TCustomImageList); procedure SetImages(Value: TCustomImageList);
procedure SetCloseButton(Value: Boolean); procedure SetCloseButton(Value: Boolean);
procedure SetMargin(Value: Integer); procedure SetMargin(Value: Integer);
procedure SetHotTab(Tab: TJvTabBarItem); procedure SetHotTab(Tab: TJvTabBarItem);
procedure SetClosingTab(Tab: TJvTabBarItem); procedure SetClosingTab(Tab: TJvTabBarItem);
procedure UpdateScrollButtons; procedure UpdateScrollButtons;
@ -318,16 +321,26 @@ type
procedure SetPageList(const Value: TCustomControl); procedure SetPageList(const Value: TCustomControl);
procedure SetOrientation(const Value: TJvTabBarOrientation); procedure SetOrientation(const Value: TJvTabBarOrientation);
procedure TimerExpired(Sender: TObject); procedure TimerExpired(Sender: TObject);
procedure SetHeight(AValue: Integer);
{$IF LCL_FullVersion >= 1090000}
private
procedure SetImagesWidth(const AValue: Integer);
protected
property ImagesWidth: Integer read FImagesWidth write SetImagesWidth default 0;
{$ENDIF}
protected protected
procedure DrawScrollBarGlyph(ACanvas: TCanvas; X, Y: Integer; ALeft, Disabled: Boolean);
procedure Resize; override;
procedure CalcTabsRects; procedure CalcTabsRects;
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean); override;
procedure DrawScrollBarGlyph(ACanvas: TCanvas; X, Y: Integer; ALeft, Disabled: Boolean);
procedure Paint; override; procedure Paint; override;
procedure PaintTab(ACanvas: TCanvas; Tab: TJvTabBarItem); virtual;
procedure PaintScrollButtons; procedure PaintScrollButtons;
procedure PaintTab(ACanvas: TCanvas; Tab: TJvTabBarItem); virtual;
procedure Resize; override;
function GetTabWidth(Tab: TJvTabBarItem): Integer; class function GetControlClassDefaultSize: TSize;
function GetTabHeight(Tab: TJvTabBarItem): Integer; function GetTabHeight(Tab: TJvTabBarItem): Integer;
function GetTabWidth(Tab: TJvTabBarItem): Integer;
function CurrentPainter: TJvTabBarPainter; function CurrentPainter: TJvTabBarPainter;
procedure Notification(Component: TComponent; Operation: TOperation); override; procedure Notification(Component: TComponent; Operation: TOperation); override;
@ -358,6 +371,7 @@ type
procedure CMMouseLeave(var Msg: TLMessage); message CM_MOUSELEAVE; procedure CMMouseLeave(var Msg: TLMessage); message CM_MOUSELEAVE;
procedure WMEraseBkgnd(var Msg: TLMEraseBkgnd); message LM_ERASEBKGND; procedure WMEraseBkgnd(var Msg: TLMEraseBkgnd); message LM_ERASEBKGND;
procedure Loaded; override; procedure Loaded; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -393,6 +407,7 @@ type
property SelectBeforeClose: Boolean read FSelectBeforeClose write FSelectBeforeClose default False; property SelectBeforeClose: Boolean read FSelectBeforeClose write FSelectBeforeClose default False;
property Margin: Integer read FMargin write SetMargin default 6; property Margin: Integer read FMargin write SetMargin default 6;
property FlatScrollButtons: Boolean read FFlatScrollButtons write SetFlatScrollButtons default True; property FlatScrollButtons: Boolean read FFlatScrollButtons write SetFlatScrollButtons default True;
property Height read GetHeight write SetHeight;
property Hint: TCaption read FHint write SetHint; property Hint: TCaption read FHint write SetHint;
property AllowTabMoving: Boolean read FAllowTabMoving write FAllowTabMoving default False; property AllowTabMoving: Boolean read FAllowTabMoving write FAllowTabMoving default False;
@ -414,10 +429,13 @@ type
TJvTabBar = class(TJvCustomTabBar) TJvTabBar = class(TJvCustomTabBar)
published published
property Align default alTop; property Align default alTop;
property AutoSize default true;
property BorderSpacing;
property Constraints;
property Cursor; property Cursor;
property PopupMenu; property PopupMenu;
property ShowHint default False; property ShowHint default False;
property Height default 23; property Height;
property Hint; property Hint;
property Visible; property Visible;
property Enabled; property Enabled;
@ -437,6 +455,9 @@ type
property PageList; property PageList;
property Painter; property Painter;
property Images; property Images;
{$IF LCL_FullVersion >= 1090000}
property ImagesWidth;
{$ENDIF}
property Tabs; property Tabs;
property OnTabClosing; property OnTabClosing;
@ -479,8 +500,8 @@ const
RIGHT_MARGIN = 6; RIGHT_MARGIN = 6;
TEXT_MARGIN_LEft = 2; TEXT_MARGIN_LEft = 2;
TEXT_MARGIN_RIGHT = 4; TEXT_MARGIN_RIGHT = 4;
TOP_MARGIN = 2; TOP_MARGIN = 4;
BOTTOM_MARGIN = 2; BOTTOM_MARGIN = 4;
CLOSE_BUTTON_SIZE = 12; CLOSE_BUTTON_SIZE = 12;
CROSS_MARGIN = 3; CROSS_MARGIN = 3;
@ -572,11 +593,13 @@ begin
FCloseButton := True; FCloseButton := True;
FAutoFreeClosed := True; FAutoFreeClosed := True;
FFlatScrollButtons := True; FFlatScrollButtons := True;
FMargin := 6; FMargin := 6;
Align := alTop; Align := alTop;
Height := 23;
with GetControlClassDefaultSize do
SetInitialBounds(0, 0, CX, CY);
AutoSize := true;
end; end;
destructor TJvCustomTabBar.Destroy; destructor TJvCustomTabBar.Destroy;
@ -727,6 +750,13 @@ begin
Invalidate; Invalidate;
end; end;
procedure TJvCustomTabBar.SetImagesWidth(const AValue: Integer);
begin
if AValue = FImagesWidth then exit;
FImagesWidth := AValue;
Invalidate;
end;
procedure TJvCustomTabBar.SetCloseButton(Value: Boolean); procedure TJvCustomTabBar.SetCloseButton(Value: Boolean);
begin begin
if Value <> FCloseButton then if Value <> FCloseButton then
@ -1384,6 +1414,45 @@ begin
FLastTabRight := X; FLastTabRight := X;
end; end;
procedure TJvCustomTabBar.CalculatePreferredSize(
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean);
var
tabSize: TSize;
imgSize: TSize;
h: Integer;
{$IF LCL_FullVersion >= 1090000}
imgRes: TScaledImageListResolution;
{$ENDIF}
begin
// Text height
Canvas.Font.Assign(Font);
PreferredHeight := Canvas.TextHeight('Tg');
// Icon height
if FImages <> nil then begin
{$IF LCL_FullVersion >= 1090000}
imgRes := FImages.ResolutionForPPI[FImagesWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
h := imgRes.Height;
if imgRes.Height > PreferredHeight then
PreferredHeight := imgRes.Height;
{$ELSE}
h := Images.Height;
{$ENDIF}
if h > PReferredHeight then
PreferredHeight := h;
end;
// Close button height
if FCloseButton then begin
h := Scale96ToForm(CLOSE_BUTTON_SIZE);
if h > PreferredHeight then
PreferredHeight := h;
end;
// Margins
inc(PreferredHeight, Scale96ToForm(TOP_MARGIN) + Scale96ToForm(BOTTOM_MARGIN));
end;
procedure TJvCustomTabBar.Paint; procedure TJvCustomTabBar.Paint;
var var
I: Integer; I: Integer;
@ -1453,6 +1522,12 @@ begin
CurrentPainter.DrawScrollButton(Canvas, Self, sbScrollRight, FBtnRightScroll.State, FBtnRightScroll.Rect); CurrentPainter.DrawScrollButton(Canvas, Self, sbScrollRight, FBtnRightScroll.State, FBtnRightScroll.Rect);
end; end;
class function TJvCustomTabBar.GetControlClassDefaultSize: TSize;
begin
Result.CX := 100;
Result.CY := 24;
end;
function TJvCustomTabBar.GetTabHeight(Tab: TJvTabBarItem): Integer; function TJvCustomTabBar.GetTabHeight(Tab: TJvTabBarItem): Integer;
begin begin
Result := CurrentPainter.GetTabSize(Canvas, Tab).cy; Result := CurrentPainter.GetTabSize(Canvas, Tab).cy;
@ -1687,6 +1762,18 @@ begin
end; end;
end; end;
function TJvCustomTabBar.GetHeight: Integer;
begin
Result := inherited Height;
end;
procedure TJvCustomTabBar.SetHeight(AValue: Integer);
begin
if AValue = GetHeight then exit;
AutoSize := false;
inherited Height := AValue;
end;
procedure TJvCustomTabBar.SetPageList(const Value: TCustomControl); procedure TJvCustomTabBar.SetPageList(const Value: TCustomControl);
var var
PageListIntf: IPageList; PageListIntf: IPageList;
@ -2082,12 +2169,40 @@ begin
TJvCustomTabBar(FOnChangeList[i]).ImagesChanged(Self); TJvCustomTabBar(FOnChangeList[i]).ImagesChanged(Self);
end; end;
function TJvTabBarPainter.GetRealImageSize(ATab: TJvTabBarItem): TSize;
{$IF LCL_FullVersion >= 1090000}
var
imgRes: TScaledImageListResolution;
tabBar: TJvCustomTabBar;
f: Double;
ppi: Integer;
begin
tabBar := GetTabBar(ATab);
f := tabBar.GetCanvasScaleFactor;
ppi := GetPixelsPerInch;
imgRes := ATab.GetImages.ResolutionForPPI[tabBar.ImagesWidth, ppi, f];
Result.CX := imgRes.Width;
Result.CY := imgRes.Height;
end;
{$ELSE}
begin
Result.CX := ATab.GetImages.Width;
Result.CY := ATab.GetImages.Height;
end;
{$ENDIF}
procedure TJvTabBarPainter.GetScrollButtons(TabBar: TJvCustomTabBar; var LeftButton, RightButton: TRect); procedure TJvTabBarPainter.GetScrollButtons(TabBar: TJvCustomTabBar; var LeftButton, RightButton: TRect);
begin begin
{ reserved for future use } { reserved for future use }
end; end;
procedure TJvTabBarPainter.DrawScrollButton(Canvas: TCanvas; TabBar: TJvCustomTabBar; Button: TJvTabBarScrollButtonKind; function TJvTabBarPainter.GetTabBar(ATab: TJvTabBarItem): TJvCustomTabBar;
begin
Result := TJvTabBarItems(ATab.Collection).TabBar;
end;
procedure TJvTabBarPainter.DrawScrollButton(Canvas: TCanvas;
TabBar: TJvCustomTabBar; Button: TJvTabBarScrollButtonKind;
State: TJvTabBarScrollButtonState; R: TRect); State: TJvTabBarScrollButtonState; R: TRect);
{$IFDEF JVCLThemesEnabled} {$IFDEF JVCLThemesEnabled}
const const
@ -2117,6 +2232,12 @@ begin
end; end;
end; end;
function TJvTabBarPainter.Scale96(AValue: Integer): Integer;
begin
Result := MulDiv(AValue, GetPixelsPerInch, 96);
end;
//=== { TJvModernTabBarPainter } ============================================= //=== { TJvModernTabBarPainter } =============================================
constructor TJvModernTabBarPainter.Create(AOwner: TComponent); constructor TJvModernTabBarPainter.Create(AOwner: TComponent);
@ -2240,6 +2361,14 @@ var
R, CloseR: TRect; R, CloseR: TRect;
ts: TTextStyle; ts: TTextStyle;
margin: Integer; margin: Integer;
x, y: Integer;
imgsize: TSize;
{$IF LCL_FullVersion >= 1090000}
imageRes: TScaledImageListResolution;
f: Double;
ppi: Integer;
tabBar: TJvCustomTabBar;
{$ENDIF}
begin begin
R := ATabRect; R := ATabRect;
@ -2316,7 +2445,7 @@ begin
Pen.Color := CloseCrossColorDisabled; Pen.Color := CloseCrossColorDisabled;
Pen.Width := 2; Pen.Width := 2;
// Draw close cross { Draw close cross }
margin := Scale96(CROSS_MARGIN); margin := Scale96(CROSS_MARGIN);
Line(CloseR.Left + margin, CloseR.Top + margin, CloseR.Right - margin - 1, CloseR.Bottom - margin - 1); Line(CloseR.Left + margin, CloseR.Top + margin, CloseR.Right - margin - 1, CloseR.Bottom - margin - 1);
Line(CloseR.Left + margin, CloseR.Bottom - margin - 1, CloseR.Right - margin - 1, CloseR.Top + margin); Line(CloseR.Left + margin, CloseR.Bottom - margin - 1, CloseR.Right - margin - 1, CloseR.Top + margin);
@ -2329,12 +2458,22 @@ begin
end; end;
{ Draw image from image list } { Draw image from image list }
if (Tab.ImageIndex <> -1) and (Tab.GetImages <> nil) then if (Tab.ImageIndex <> -1) and (Tab.GetImages <> nil) then
begin begin
Tab.GetImages.Draw(Canvas, R.Left, (R.Top + R.Bottom - Tab.GetImages.Height) div 2, imgsize := GetRealImageSize(Tab);
Tab.ImageIndex, Tab.Enabled); x := R.Left;
Inc(R.Left, Tab.GetImages.Width + Scale96(TEXT_MARGIN_LEFT)); y := (R.Top + R.Bottom - imgSize.CY) div 2;
{$IF LCL_FullVersion >= 1090000}
tabBar := GetTabBar(Tab);
f := tabBar.GetCanvasScalefactor;
ppi := GetPixelsPerInch;
if Tab.GetImages <> nil then
imageRes := Tab.GetImages.ResolutionForPPI[tabBar.ImagesWidth, ppi, f];
imageRes.Draw(Canvas, x, y, Tab.ImageIndex, tab.Enabled);
{$ELSE}
Tab.GetImages.Draw(Canvas, x, y, Tab.ImageIndex, Tab.Enabled);
{$ENDIF}
Inc(R.Left, imgSize.CX + Scale96(TEXT_MARGIN_LEFT));
end; end;
if Tab.Enabled then if Tab.Enabled then
@ -2373,10 +2512,15 @@ begin
Result := 1; Result := 1;
end; end;
function TJvModernTabBarPainter.GetPixelsPerInch: Integer;
begin
Result := Font.PixelsPerInch;
end;
function TJvModernTabBarPainter.GetTabSize(Canvas: TCanvas; Tab: TJvTabBarItem): TSize; function TJvModernTabBarPainter.GetTabSize(Canvas: TCanvas; Tab: TJvTabBarItem): TSize;
var var
w: Integer; w, h: Integer;
h: Integer; imgSize: TSize;
begin begin
if Tab.Enabled then if Tab.Enabled then
begin begin
@ -2406,24 +2550,13 @@ begin
// Extend width and height by image // Extend width and height by image
if (Tab.ImageIndex <> -1) and (Tab.GetImages <> nil) then begin if (Tab.ImageIndex <> -1) and (Tab.GetImages <> nil) then begin
w := Tab.GetImages.Width; imgSize := GetRealImageSize(Tab);
h := Tab.GetImages.Height; inc(Result.CX, imgSize.CX + Scale96(TEXT_MARGIN_LEFT));
inc(Result.CX, w + Scale96(TEXT_MARGIN_LEFT)); if Result.CY < imgSize.CY then
if Result.CY < h then Result.CY := imgSize.CY;
Result.CY := h;
end; end;
inc(Result.CY, Scale96(TOP_MARGIN) + Scale96(BOTTOM_MARGIN)); inc(Result.CY, Scale96(TOP_MARGIN) + Scale96(BOTTOM_MARGIN));
(*
Result.cx := Canvas.TextWidth(Tab.Caption) + 11;
Result.cy := Canvas.TextHeight(Tab.Caption + 'Ag') + 7;
if Tab.TabBar.CloseButton then
Result.cx := Result.cx + 15;
if (Tab.ImageIndex <> -1) and (Tab.GetImages <> nil) then
Result.cx := Result.cx + Tab.GetImages.Width + 2;
*)
// Override width if TabWidth is fixed. // Override width if TabWidth is fixed.
if TabWidth > 0 then if TabWidth > 0 then
Result.cx := TabWidth; Result.cx := TabWidth;
@ -2439,11 +2572,6 @@ begin
Changed; Changed;
end; end;
function TJvModernTabBarPainter.Scale96(AValue: Integer): Integer;
begin
Result := MulDiv(AValue, Font.PixelsPerInch, 96);
end;
procedure TJvModernTabBarPainter.SetBorderColor(const Value: TColor); procedure TJvModernTabBarPainter.SetBorderColor(const Value: TColor);
begin begin
if Value <> FBorderColor then if Value <> FBorderColor then