mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-26 20:01:44 +01:00
Reworks the cdtrackbar drawing code, greatly simplifying and improving it
git-svn-id: trunk@32511 -
This commit is contained in:
parent
0203c4d30c
commit
783508a38e
@ -375,21 +375,18 @@ type
|
|||||||
|
|
||||||
TCDTrackBar = class(TCustomControl)
|
TCDTrackBar = class(TCustomControl)
|
||||||
private
|
private
|
||||||
FMDown: boolean;
|
DragDropStarted: boolean;
|
||||||
|
// fields
|
||||||
FMin: integer;
|
FMin: integer;
|
||||||
FMax: integer;
|
FMax: integer;
|
||||||
FPosition: integer;
|
FPosition: integer;
|
||||||
FOnChange: TNotifyEvent;
|
FOnChange: TNotifyEvent;
|
||||||
FCurrentDrawer: TCDTrackBarDrawer;
|
FCurrentDrawer: TCDTrackBarDrawer;
|
||||||
FFromColor, FToColor: TColor;
|
|
||||||
FStepWidth: integer;
|
|
||||||
FAutoWidth: boolean;
|
|
||||||
procedure SetMax(Value: integer);
|
procedure SetMax(Value: integer);
|
||||||
procedure SetMin(Value: integer);
|
procedure SetMin(Value: integer);
|
||||||
procedure SetPosition(Value: integer);
|
procedure SetPosition(Value: integer);
|
||||||
procedure SetFromColor(Value: TColor);
|
//
|
||||||
procedure SetToColor(Value: TColor);
|
function GetPositionFromMousePos(X, Y: Integer): integer;
|
||||||
procedure SetStepWidth(Value: integer);
|
|
||||||
protected
|
protected
|
||||||
procedure Changed; virtual;
|
procedure Changed; virtual;
|
||||||
// keyboard
|
// keyboard
|
||||||
@ -405,19 +402,14 @@ type
|
|||||||
procedure MouseEnter; override;
|
procedure MouseEnter; override;
|
||||||
procedure MouseLeave; override;
|
procedure MouseLeave; override;
|
||||||
public
|
public
|
||||||
xPosition: integer;
|
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure EraseBackground(DC: HDC); override;
|
procedure EraseBackground(DC: HDC); override;
|
||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
published
|
published
|
||||||
property AutoWidth: boolean read FAutoWidth write FAutoWidth;
|
|
||||||
property Color;
|
property Color;
|
||||||
property Max: integer read FMax write SetMax default 10;
|
property Max: integer read FMax write SetMax default 10;
|
||||||
property Min: integer read FMin write SetMin default 0;
|
property Min: integer read FMin write SetMin default 0;
|
||||||
property ColorFrom: TColor read FFromColor write SetFromColor;
|
|
||||||
property StepWidth: integer read FStepWidth write SetStepWidth;
|
|
||||||
property ColorTo: TColor read FToColor write SetToColor;
|
|
||||||
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
property OnChange: TNotifyEvent read FOnChange write FOnChange;
|
||||||
property Position: integer read FPosition write SetPosition;
|
property Position: integer read FPosition write SetPosition;
|
||||||
property TabStop default True;
|
property TabStop default True;
|
||||||
@ -428,14 +420,17 @@ type
|
|||||||
TCDTrackBarDrawer = class
|
TCDTrackBarDrawer = class
|
||||||
public
|
public
|
||||||
procedure DrawToIntfImage(ADest: TFPImageCanvas; FPImg: TLazIntfImage;
|
procedure DrawToIntfImage(ADest: TFPImageCanvas; FPImg: TLazIntfImage;
|
||||||
CDTrackBar: TCDTrackBar; FromColor, ToColor: TColor; pWidth: integer);
|
CDTrackBar: TCDTrackBar); virtual; abstract;
|
||||||
virtual; abstract;
|
procedure GetGeometry(var ALeftBorder, ARightBorder: Integer); virtual; abstract;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TCDTrackBarDrawerGraph }
|
||||||
|
|
||||||
TCDTrackBarDrawerGraph = class(TCDTrackBarDrawer)
|
TCDTrackBarDrawerGraph = class(TCDTrackBarDrawer)
|
||||||
public
|
public
|
||||||
procedure DrawToIntfImage(ADest: TFPImageCanvas; FPImg: TLazIntfImage;
|
procedure DrawToIntfImage(ADest: TFPImageCanvas; FPImg: TLazIntfImage;
|
||||||
CDTrackBar: TCDTrackBar; FromColor, ToColor: TColor; pWidth: integer); override;
|
CDTrackBar: TCDTrackBar); override;
|
||||||
|
procedure GetGeometry(var ALeftBorder, ARightBorder: Integer); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{TCDTabControl}
|
{TCDTabControl}
|
||||||
@ -1775,12 +1770,25 @@ end;
|
|||||||
|
|
||||||
procedure TCDTrackBar.SetPosition(Value: integer);
|
procedure TCDTrackBar.SetPosition(Value: integer);
|
||||||
begin
|
begin
|
||||||
if Value = FPosition then
|
if Value = FPosition then Exit;
|
||||||
Exit;
|
|
||||||
FPosition := Value;
|
FPosition := Value;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCDTrackBar.GetPositionFromMousePos(X, Y: integer): integer;
|
||||||
|
var
|
||||||
|
lLeftBorder, lRightBorder: Integer;
|
||||||
|
begin
|
||||||
|
FCurrentDrawer.GetGeometry(lLeftBorder, lRightBorder);
|
||||||
|
if X > Width - lRightBorder then Result := FMax
|
||||||
|
else if X < lLeftBorder then Result := FMin
|
||||||
|
else Result := FMin + (X - lLeftBorder) * (FMax - FMin + 1) div (Width - lRightBorder - lLeftBorder);
|
||||||
|
|
||||||
|
// sanity check
|
||||||
|
if Result > FMax then Result := FMax;
|
||||||
|
if Result < FMin then Result := FMin;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCDTrackBar.Changed;
|
procedure TCDTrackBar.Changed;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
@ -1797,16 +1805,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCDTrackBar.KeyDown(var Key: word; Shift: TShiftState);
|
procedure TCDTrackBar.KeyDown(var Key: word; Shift: TShiftState);
|
||||||
|
var
|
||||||
|
NewPosition: Integer;
|
||||||
begin
|
begin
|
||||||
inherited KeyDown(Key, Shift);
|
inherited KeyDown(Key, Shift);
|
||||||
if (Key = 37) or (Key = 40) then
|
if (Key = 37) or (Key = 40) then
|
||||||
Position := Position - (FMax - FMin) div 10;
|
NewPosition := FPosition - (FMax - FMin) div 10;
|
||||||
if (Key = 38) or (Key = 39) then
|
if (Key = 38) or (Key = 39) then
|
||||||
Position := Position + (FMax - FMin) div 10;
|
NewPosition := FPosition + (FMax - FMin) div 10;
|
||||||
if Position > FMax then
|
|
||||||
Position := FMax;
|
// sanity check
|
||||||
if Position < FMin then
|
if NewPosition > FMax then NewPosition := FMax;
|
||||||
Position := FMin;
|
if NewPosition < FMin then NewPosition := FMin;
|
||||||
|
|
||||||
|
Position := NewPosition;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCDTrackBar.KeyUp(var Key: word; Shift: TShiftState);
|
procedure TCDTrackBar.KeyUp(var Key: word; Shift: TShiftState);
|
||||||
@ -1816,44 +1828,34 @@ end;
|
|||||||
|
|
||||||
procedure TCDTrackBar.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure TCDTrackBar.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: integer);
|
X, Y: integer);
|
||||||
|
var
|
||||||
|
NewPosition: Integer;
|
||||||
begin
|
begin
|
||||||
SetFocus;
|
SetFocus;
|
||||||
FPosition := FMin + (X - 8) * (FMax - FMin + 1) div (Width - 14);
|
|
||||||
if X > Width - 14 then
|
NewPosition := GetPositionFromMousePos(X, Y);
|
||||||
FPosition := FMax;
|
|
||||||
if X < 13 then
|
DragDropStarted := True;
|
||||||
FPosition := FMin;
|
|
||||||
xPosition := X;
|
Position := NewPosition;
|
||||||
if X > Width - 14 then
|
|
||||||
xPosition := Width - 14;
|
|
||||||
if X < 13 then
|
|
||||||
xPosition := 13;
|
|
||||||
invalidate;
|
|
||||||
FMDown := True;
|
|
||||||
inherited MouseDown(Button, Shift, X, Y);
|
inherited MouseDown(Button, Shift, X, Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCDTrackBar.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer);
|
procedure TCDTrackBar.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: integer);
|
||||||
begin
|
begin
|
||||||
FMDown := False;
|
DragDropStarted := False;
|
||||||
inherited MouseUp(Button, Shift, X, Y);
|
inherited MouseUp(Button, Shift, X, Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCDTrackBar.MouseMove(Shift: TShiftState; X, Y: integer);
|
procedure TCDTrackBar.MouseMove(Shift: TShiftState; X, Y: integer);
|
||||||
|
var
|
||||||
|
NewPosition: Integer;
|
||||||
begin
|
begin
|
||||||
if FMDown then
|
if DragDropStarted then
|
||||||
begin
|
begin
|
||||||
FPosition := FMin + (X - 8) * (FMax - FMin + 1) div (Width - 14);
|
NewPosition := GetPositionFromMousePos(X, Y);
|
||||||
if X > Width - 14 then
|
Position := NewPosition;
|
||||||
FPosition := FMax;
|
|
||||||
if X < 13 then
|
|
||||||
FPosition := FMin;
|
|
||||||
xPosition := X;
|
|
||||||
if X > Width - 14 then
|
|
||||||
xPosition := Width - 14;
|
|
||||||
if X < 13 then
|
|
||||||
xPosition := 13;
|
|
||||||
invalidate;
|
|
||||||
end;
|
end;
|
||||||
inherited MouseMove(Shift, X, Y);
|
inherited MouseMove(Shift, X, Y);
|
||||||
end;
|
end;
|
||||||
@ -1878,12 +1880,6 @@ begin
|
|||||||
FMax := 10;
|
FMax := 10;
|
||||||
FMin := 0;
|
FMin := 0;
|
||||||
TabStop := True;
|
TabStop := True;
|
||||||
FFromColor := clWhite;
|
|
||||||
FToColor := clGray;
|
|
||||||
FStepWidth := 11;
|
|
||||||
TabStop := True;
|
|
||||||
xPosition := 13;
|
|
||||||
FAutoWidth := True;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCDTrackBar.Destroy;
|
destructor TCDTrackBar.Destroy;
|
||||||
@ -1894,7 +1890,7 @@ end;
|
|||||||
|
|
||||||
procedure TCDTrackBar.EraseBackground(DC: HDC);
|
procedure TCDTrackBar.EraseBackground(DC: HDC);
|
||||||
begin
|
begin
|
||||||
inherited EraseBackground(DC);
|
//inherited EraseBackground(DC);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCDTrackBar.Paint;
|
procedure TCDTrackBar.Paint;
|
||||||
@ -1911,8 +1907,7 @@ begin
|
|||||||
AImage := ABmp.CreateIntfImage;
|
AImage := ABmp.CreateIntfImage;
|
||||||
lCanvas := TFPImageCanvas.Create(AImage);
|
lCanvas := TFPImageCanvas.Create(AImage);
|
||||||
// First step of the drawing: FCL TFPCustomCanvas for fast pixel access
|
// First step of the drawing: FCL TFPCustomCanvas for fast pixel access
|
||||||
FCurrentDrawer.DrawToIntfImage(lCanvas, AImage, Self, FFromColor,
|
FCurrentDrawer.DrawToIntfImage(lCanvas, AImage, Self);
|
||||||
FToColor, FStepWidth);
|
|
||||||
ABmp.LoadFromIntfImage(AImage);
|
ABmp.LoadFromIntfImage(AImage);
|
||||||
Canvas.Draw(0, 0, ABmp);
|
Canvas.Draw(0, 0, ABmp);
|
||||||
finally
|
finally
|
||||||
@ -1924,49 +1919,32 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCDTrackBar.SetFromColor(Value: TColor);
|
|
||||||
begin
|
|
||||||
FFromColor := Value;
|
|
||||||
invalidate;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCDTrackBar.SetToColor(Value: TColor);
|
|
||||||
begin
|
|
||||||
FToColor := Value;
|
|
||||||
invalidate;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCDTrackBar.SetStepWidth(Value: integer);
|
|
||||||
begin
|
|
||||||
FStepWidth := Value;
|
|
||||||
invalidate;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TCDTrackBarDrawer }
|
{ TCDTrackBarDrawer }
|
||||||
|
|
||||||
procedure TCDTrackBarDrawerGraph.DrawToIntfImage(ADest: TFPImageCanvas;
|
procedure TCDTrackBarDrawerGraph.DrawToIntfImage(ADest: TFPImageCanvas;
|
||||||
FPImg: TLazIntfImage; CDTrackBar: TCDTrackBar; FromColor, ToColor: TColor;
|
FPImg: TLazIntfImage; CDTrackBar: TCDTrackBar);
|
||||||
pWidth: integer);
|
|
||||||
const
|
const
|
||||||
CDBarEdge = 16;
|
CDBarEdge = 18;
|
||||||
var
|
var
|
||||||
aStart, StepsCount, i, pStart, pEnd, pDelta: integer;
|
lDrawingBottom, StepsCount, i: Integer;
|
||||||
|
pStart, pEnd: integer; // for drawing the decorative bars
|
||||||
dRect: TRect;
|
dRect: TRect;
|
||||||
TempB: TLazIntfImage;
|
pStepWidth, pHalfStepWidth: Integer;
|
||||||
BCanvas: TFPImageCanvas;
|
|
||||||
ABmp: TBitmap = nil;
|
|
||||||
pStepWidth: Double;
|
|
||||||
begin
|
begin
|
||||||
|
// Sanity check
|
||||||
if CDTrackBar.Max - CDTrackBar.Min <= 0 then
|
if CDTrackBar.Max - CDTrackBar.Min <= 0 then
|
||||||
Exit;
|
raise Exception.Create('[TCDTrackBarDrawerGraph.DrawToIntfImage] Max-Min must be at least 1');
|
||||||
|
|
||||||
|
// Preparations
|
||||||
StepsCount := CDTrackBar.Max - CDTrackBar.Min + 1;
|
StepsCount := CDTrackBar.Max - CDTrackBar.Min + 1;
|
||||||
if CDTrackBar.AutoWidth then
|
pStepWidth := (CDTrackBar.Width - CDBarEdge) div StepsCount;
|
||||||
pStepWidth := (CDTrackBar.Width - CDBarEdge) / StepsCount
|
pHalfStepWidth := (CDTrackBar.Width - CDBarEdge) div (StepsCount * 2);
|
||||||
else
|
|
||||||
pStepWidth := Round(pWidth);
|
// The bottom part of the drawing
|
||||||
if pWidth <= 0 then pWidth := 1;
|
lDrawingBottom := CDTrackBar.Height - 10;
|
||||||
|
|
||||||
// Background
|
// Background
|
||||||
|
|
||||||
if CDTrackBar.Parent = nil then
|
if CDTrackBar.Parent = nil then
|
||||||
ADest.Brush.FPColor := colLtGray
|
ADest.Brush.FPColor := colLtGray
|
||||||
else
|
else
|
||||||
@ -1975,108 +1953,82 @@ begin
|
|||||||
ADest.Pen.Style := psClear;
|
ADest.Pen.Style := psClear;
|
||||||
ADest.Rectangle(0, 0, CDTrackBar.Width, CDTrackBar.Height);
|
ADest.Rectangle(0, 0, CDTrackBar.Width, CDTrackBar.Height);
|
||||||
ADest.Brush.FPColor := TColorToFPColor(ColorToRGB($006BB6E6));
|
ADest.Brush.FPColor := TColorToFPColor(ColorToRGB($006BB6E6));
|
||||||
//aStart := CDTrackBar.Height div 2 + 1;
|
|
||||||
aStart := CDTrackBar.Height - 10;
|
// Draws the double-sided arrow in the center of the slider
|
||||||
|
|
||||||
ADest.Pen.Style := psSolid;
|
ADest.Pen.Style := psSolid;
|
||||||
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($006BB6E6));
|
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($006BB6E6));
|
||||||
//ADest.Rectangle(0, aStart, CDTrackBar.Width, aStart);
|
ADest.Line(0, lDrawingBottom, CDTrackBar.Width, lDrawingBottom);
|
||||||
ADest.Line(0, aStart, CDTrackBar.Width, aStart);
|
ADest.Line(3, lDrawingBottom - 1, 6, lDrawingBottom - 1);
|
||||||
ADest.Line(3, aStart - 1, 6, aStart - 1);
|
ADest.Line(5, lDrawingBottom - 2, 6, lDrawingBottom - 2);
|
||||||
ADest.Line(5, aStart - 2, 6, aStart - 2);
|
ADest.Line(3, lDrawingBottom + 1, 6, lDrawingBottom + 1);
|
||||||
ADest.Line(3, aStart + 1, 6, aStart + 1);
|
ADest.Line(5, lDrawingBottom + 2, 6, lDrawingBottom + 2);
|
||||||
ADest.Line(5, aStart + 2, 6, aStart + 2);
|
ADest.Line(CDTrackBar.Width - 1 - 3, lDrawingBottom - 1, CDTrackBar.Width - 1 - 6, lDrawingBottom - 1);
|
||||||
//pStart := ((CDTrackBar.Position - CDTrackBar.Min) * (CDTrackBar.Width - 32)) div
|
ADest.Line(CDTrackBar.Width - 1 - 5, lDrawingBottom - 2, CDTrackBar.Width - 1 - 6, lDrawingBottom - 2);
|
||||||
// (CDTrackBar.Max - CDTrackBar.Min) + 2;
|
ADest.Line(CDTrackBar.Width - 1 - 3, lDrawingBottom + 1, CDTrackBar.Width - 1 - 6, lDrawingBottom + 1);
|
||||||
pStart := CDTrackBar.xPosition;
|
ADest.Line(CDTrackBar.Width - 1 - 5, lDrawingBottom + 2, CDTrackBar.Width - 1 - 6, lDrawingBottom + 2);
|
||||||
ADest.Line(CDTrackBar.Width - 1 - 3, aStart - 1, CDTrackBar.Width - 1 - 6, aStart - 1);
|
|
||||||
ADest.Line(CDTrackBar.Width - 1 - 5, aStart - 2, CDTrackBar.Width - 1 - 6, aStart - 2);
|
|
||||||
ADest.Line(CDTrackBar.Width - 1 - 3, aStart + 1, CDTrackBar.Width - 1 - 6, aStart + 1);
|
|
||||||
ADest.Line(CDTrackBar.Width - 1 - 5, aStart + 2, CDTrackBar.Width - 1 - 6, aStart + 2);
|
|
||||||
{ ADest.Rectangle(pStart - 5, aStart + 1, pStart + 5, aStart + 6);
|
|
||||||
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($005BA6C6));
|
|
||||||
ADest.RecTangle(pStart - 5, aStart + 2, pStart + 5, aStart + 7);
|
|
||||||
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($006BB6E6));
|
|
||||||
ADest.RecTangle(pStart - 5, aStart, pStart + 5, aStart + 2); }
|
|
||||||
//RNum := (CDTrackBar.Width - 14) div pWidth;
|
|
||||||
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB(clGray));
|
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB(clGray));
|
||||||
ADest.Brush.FPColor := TColorToFPColor(ColorToRGB($00F0F0F0));
|
ADest.Brush.FPColor := TColorToFPColor(ColorToRGB($00F0F0F0));
|
||||||
ABmp := TBitmap.Create;
|
|
||||||
ABmp.Width := CDTrackBar.Width;
|
|
||||||
ABmp.Height := CDTrackBar.Height;
|
|
||||||
|
|
||||||
TempB := ABmp.CreateIntfImage;
|
// Draws the decorative bars and also the slider button
|
||||||
//TempB := TLazIntfImage.Create(0, 0);
|
|
||||||
//TempB.UsePalette := False;
|
|
||||||
//TempB.Width := CDTrackBar.Width;
|
|
||||||
//TempB.Height := CDTrackBar.Height;
|
|
||||||
BCanvas := TFPImageCanvas.Create(TempB);
|
|
||||||
//BCanvas.Brush.FPColor := TColorToFPColor(ColorToRGB(clRed));
|
|
||||||
BCanvas.Brush.Style := bsSolid;
|
|
||||||
//GradHFill(BCanvas, Rect(0, 0, CDTrackBar.Width, CDTrackBar.Height),
|
|
||||||
// GetAColor(FromColor, 70 + i), GetAColor(ToColor, 90 + i));
|
|
||||||
GradCenterFill(BCanvas, Rect(0, 0, CDTrackBar.Width, CDTrackBar.Height),
|
|
||||||
FromColor, ToColor, CDTrackBar.Position / StepsCount);
|
|
||||||
|
|
||||||
pStart := 10 - 1;
|
pStart := 10 - 1;
|
||||||
for i := 0 to StepsCount - 1 do
|
for i := 0 to StepsCount - 1 do
|
||||||
begin
|
begin
|
||||||
|
// Draw the decorative bars
|
||||||
|
dRect := Bounds(
|
||||||
|
pStart + pHalfStepWidth,
|
||||||
|
lDrawingBottom - 5 - i,
|
||||||
|
Round(pStepWidth)-3,
|
||||||
|
4 + i);
|
||||||
|
|
||||||
ADest.Brush.Style := bsSolid;
|
ADest.Brush.Style := bsSolid;
|
||||||
// GradHFill(ADest, dRect, GetAColor(FromColor, 70 + i), GetAColor(ToColor, 90 + i));
|
ADest.Pen.Style := psSolid;
|
||||||
if aStart - 5 - i > 0 then
|
ADest.Pen.FPColor := colBlack;
|
||||||
|
if i + CDTrackBar.Min = CDTrackBar.Position then
|
||||||
|
ADest.Brush.FPColor := colDkGray
|
||||||
|
else
|
||||||
|
ADest.Brush.FPColor := colWhite;
|
||||||
|
|
||||||
|
ADest.Rectangle(dRect);
|
||||||
|
|
||||||
|
// Draw the slider
|
||||||
|
|
||||||
|
if i + CDTrackBar.Min = CDTrackBar.Position then
|
||||||
begin
|
begin
|
||||||
{if i = RNum - 1 then
|
ADest.Brush.FPColor := TColorToFPColor(ColorToRGB($006BB6E6));
|
||||||
pDelta := CDTrackBar.Width - (10 + i * pWidth + pWidth - 3) - 11
|
ADest.Brush.Style := bsSolid;
|
||||||
else
|
ADest.Rectangle(pStart, lDrawingBottom + 1, pStart + 10, lDrawingBottom + 6);
|
||||||
pDelta := 0; }
|
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($005BA6C6));
|
||||||
if i > StepsCount - (CDTrackBar.Width - CDBarEdge) mod pWidth then
|
ADest.RecTangle(pStart, lDrawingBottom + 2, pStart + 10, lDrawingBottom + 7);
|
||||||
pDelta := 1
|
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($006BB6E6));
|
||||||
else
|
ADest.RecTangle(pStart, lDrawingBottom, pStart + 10, lDrawingBottom + 2);
|
||||||
pDelta := 0;
|
|
||||||
pEnd := pStart + Round(pStepWidth) - 3 + pDelta;
|
|
||||||
dRect := Rect(pStart, aStart - 5 - i, pEnd, aStart - 1);
|
|
||||||
//FPImgCloneRect(TempB, FPImg, Rect(10 + i * pWidth, aStart - 5 -
|
|
||||||
// i, 10 + i * pWidth + pWidth - 3 + pDelta, aStart - 1), False);
|
|
||||||
FPImgCloneRect(TempB, FPImg, dRect, False);
|
|
||||||
ADest.Brush.Style := bsClear;
|
|
||||||
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB(clGray));
|
|
||||||
//ADest.RecTangle(10 + i * pWidth, aStart - 5 - i, 10 + i * pWidth +
|
|
||||||
// pWidth - 3 + pDelta, aStart - 1);
|
|
||||||
ADest.RecTangle(dRect);
|
|
||||||
if i = CDTrackBar.Position - CDTrackBar.Min then
|
|
||||||
begin
|
|
||||||
ADest.Brush.FPColor := TColorToFPColor(ColorToRGB($006BB6E6));
|
|
||||||
ADest.Brush.Style := bsSolid;
|
|
||||||
ADest.Rectangle(pStart, aStart + 1, pStart + 10, aStart + 6);
|
|
||||||
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($005BA6C6));
|
|
||||||
ADest.RecTangle(pStart, aStart + 2, pStart + 10, aStart + 7);
|
|
||||||
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($006BB6E6));
|
|
||||||
ADest.RecTangle(pStart, aStart, pStart + 10, aStart + 2);
|
|
||||||
end;
|
|
||||||
//pStart := pStart + pWidth + pDelta - 1;
|
|
||||||
pStart := pEnd + 1 + 2;
|
|
||||||
end;
|
end;
|
||||||
|
pStart := pStart + pStepWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($007BC6F6));
|
ADest.Pen.FPColor := TColorToFPColor(ColorToRGB($007BC6F6));
|
||||||
ADest.Line(7, aStart - 1, CDTrackBar.Width - 8, aStart - 1);
|
ADest.Line(7, lDrawingBottom - 1, CDTrackBar.Width - 8, lDrawingBottom - 1);
|
||||||
ADest.Line(7, aStart + 1, CDTrackBar.Width - 8, aStart + 1);
|
ADest.Line(7, lDrawingBottom + 1, CDTrackBar.Width - 8, lDrawingBottom + 1);
|
||||||
ADest.Colors[2, aStart - 1] := ADest.Pen.FPColor;
|
ADest.Colors[2, lDrawingBottom - 1] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[4, aStart - 2] := ADest.Pen.FPColor;
|
ADest.Colors[4, lDrawingBottom - 2] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[2, aStart + 1] := ADest.Pen.FPColor;
|
ADest.Colors[2, lDrawingBottom + 1] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[4, aStart + 2] := ADest.Pen.FPColor;
|
ADest.Colors[4, lDrawingBottom + 2] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[6, aStart - 3] := ADest.Pen.FPColor;
|
ADest.Colors[6, lDrawingBottom - 3] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[6, aStart + 3] := ADest.Pen.FPColor;
|
ADest.Colors[6, lDrawingBottom + 3] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[CDTrackBar.Width - 1 - 2, aStart - 1] := ADest.Pen.FPColor;
|
ADest.Colors[CDTrackBar.Width - 1 - 2, lDrawingBottom - 1] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[CDTrackBar.Width - 1 - 4, aStart - 2] := ADest.Pen.FPColor;
|
ADest.Colors[CDTrackBar.Width - 1 - 4, lDrawingBottom - 2] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[CDTrackBar.Width - 1 - 2, aStart + 1] := ADest.Pen.FPColor;
|
ADest.Colors[CDTrackBar.Width - 1 - 2, lDrawingBottom + 1] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[CDTrackBar.Width - 1 - 4, aStart + 2] := ADest.Pen.FPColor;
|
ADest.Colors[CDTrackBar.Width - 1 - 4, lDrawingBottom + 2] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[CDTrackBar.Width - 1 - 6, aStart - 3] := ADest.Pen.FPColor;
|
ADest.Colors[CDTrackBar.Width - 1 - 6, lDrawingBottom - 3] := ADest.Pen.FPColor;
|
||||||
ADest.Colors[CDTrackBar.Width - 1 - 6, aStart + 3] := ADest.Pen.FPColor;
|
ADest.Colors[CDTrackBar.Width - 1 - 6, lDrawingBottom + 3] := ADest.Pen.FPColor;
|
||||||
//ADest.Draw(0,0,TempB);
|
end;
|
||||||
//ADest.CopyRect(0, 0, BCanvas, Rect(0, 0, CDTrackBar.Width, CDTrackBar.Height));
|
|
||||||
//FPIMGCopyRect(TempB, FPImg, Rect(10, 10, CDTrackBar.Width - 11, CDTrackBar.Height - 11));
|
procedure TCDTrackBarDrawerGraph.GetGeometry(var ALeftBorder,
|
||||||
BCanvas.Free;
|
ARightBorder: Integer);
|
||||||
TempB.Free;
|
begin
|
||||||
ABmp.Free;
|
ALeftBorder := 9;
|
||||||
|
ARightBorder := 9;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{TCDTabControlItemList}
|
{TCDTabControlItemList}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user