📄 iscalecomponent.pas
字号:
function TiScaleComponent.GetTickMajorColor : TColor; begin Result := FScaleObject.TickMajorColor end;
function TiScaleComponent.GetTickMajorCount : Integer; begin Result := FScaleObject.TickMajorCount end;
function TiScaleComponent.GetTickMajorLength : Integer; begin Result := FScaleObject.TickMajorLength end;
function TiScaleComponent.GetTickMajorStyle : TiBevelStyle; begin Result := FScaleObject.TickMajorStyle end;
function TiScaleComponent.GetTickMargin : Integer; begin Result := FScaleObject.TickMargin end;
function TiScaleComponent.GetTickMinorAlignment : TiTickMinorAlignment; begin Result := FScaleObject.TickMinorAlignment end;
function TiScaleComponent.GetTickMinorColor : TColor; begin Result := FScaleObject.TickMinorColor end;
function TiScaleComponent.GetTickMinorCount : Integer; begin Result := FScaleObject.TickMinorCount end;
function TiScaleComponent.GetTickMinorLength : Integer; begin Result := FScaleObject.TickMinorLength end;
function TiScaleComponent.GetTickMinorStyle : TiBevelStyle; begin Result := FScaleObject.TickMinorStyle end;
function TiScaleComponent.GetPrecisionStyle : TiPrecisionStyle; begin Result := FScaleObject.PrecisionStyle end;
function TiScaleComponent.GetOnCustomizeTickLabel : TOnCustomizeTickLabel;begin Result := FScaleObject.OnCustomizeTickLabel end;
//****************************************************************************************************************************************************
procedure TiScaleComponent.SetShowTickLabels (const Value: Boolean); begin FScaleObject.ShowTickLabels := Value; end;
procedure TiScaleComponent.SetShowTicksMajor (const Value: Boolean); begin FScaleObject.ShowTicksMajor := Value; end;
procedure TiScaleComponent.SetShowTicksMinor (const Value: Boolean); begin FScaleObject.ShowTicksMinor := Value; end;
procedure TiScaleComponent.SetShowTicksMajorFirstLast(const Value: Boolean); begin FScaleObject.ShowTicksMajorFirstLast := Value; end;
procedure TiScaleComponent.SetTickLabelFont (const Value: TFont ); begin FScaleObject.TickLabelFont := Value; end;
procedure TiScaleComponent.SetTickLabelMargin (const Value: Integer); begin FScaleObject.TickLabelMargin := Value; end;
procedure TiScaleComponent.SetTickLabelPrecision (const Value: Integer); begin FScaleObject.TickLabelPrecision := Value; end;
procedure TiScaleComponent.SetTickMajorColor (const Value: TColor ); begin FScaleObject.TickMajorColor := Value; end;
procedure TiScaleComponent.SetTickMajorCount (const Value: Integer); begin FScaleObject.TickMajorCount := Value; end;
procedure TiScaleComponent.SetTickMajorLength (const Value: Integer); begin FScaleObject.TickMajorLength := Value; end;
procedure TiScaleComponent.SetTickMajorStyle (const Value: TiBevelStyle); begin FScaleObject.TickMajorStyle := Value; end;
procedure TiScaleComponent.SetTickMargin (const Value: Integer); begin FScaleObject.TickMargin := Value; end;
procedure TiScaleComponent.SetTickMinorAlignment (const Value: TiTickMinorAlignment); begin FScaleObject.TickMinorAlignment := Value; end;
procedure TiScaleComponent.SetTickMinorColor (const Value: TColor ); begin FScaleObject.TickMinorColor := Value; end;
procedure TiScaleComponent.SetTickMinorCount (const Value: Integer); begin FScaleObject.TickMinorCount := Value; end;
procedure TiScaleComponent.SetTickMinorLength (const Value: Integer); begin FScaleObject.TickMinorLength := Value; end;
procedure TiScaleComponent.SetTickMinorStyle (const Value: TiBevelStyle); begin FScaleObject.TickMinorStyle := Value; end;
procedure TiScaleComponent.SetPrecisionStyle (const Value: TiPrecisionStyle); begin FScaleObject.PrecisionStyle := Value; end;
procedure TiScaleComponent.SetOnCustomizeTickLabel (const Value: TOnCustomizeTickLabel);begin FScaleObject.OnCustomizeTickLabel := Value; end;
//****************************************************************************************************************************************************
procedure TiScaleComponent.ScaleChange(Sender : TObject);
begin
BackGroundChange;
end;
//****************************************************************************************************************************************************
procedure TiScaleComponent.SetAutoScaleEnabled(const Value: Boolean);
begin
if FAutoScaleEnabled <> Value then
begin
FAutoScaleEnabled := Value;
FScaleObject.AutoScaleEnabled := Value;
DoAutoScale(PositionMin, PositionMax);
end;
end;
//****************************************************************************************************************************************************
procedure TiScaleComponent.SetAutoScaleDesiredTicks(const Value: Integer);
begin
if Value < 2 then exit;
if FAutoScaleDesiredTicks <> Value then
begin
FAutoScaleDesiredTicks := Value;
FScaleObject.AutoScaleDesiredTicks := Value;
DoAutoScale(PositionMin, PositionMax);
end;
end;
//****************************************************************************************************************************************************
procedure TiScaleComponent.SetAutoScaleMaxTicks(const Value: Integer);
begin
if Value < 2 then exit;
if FAutoScaleMaxTicks <> Value then
begin
FAutoScaleMaxTicks := Value;
FScaleObject.AutoScaleMaxTicks := Value;
DoAutoScale(PositionMin, PositionMax);
end;
end;
//****************************************************************************************************************************************************
procedure TiScaleComponent.SetAutoScaleStyle(const Value: TiAutoScaleStyle);
begin
if FAutoScaleStyle <> Value then
begin
FAutoScaleStyle := Value;
FScaleObject.AutoScaleStyle := Value;
DoAutoScale(PositionMin, PositionMax);
end;
end;
//****************************************************************************************************************************************************
procedure TiScaleComponent.DoAutoScale(DesiredMin, DesiredMax: Double);
var
NewMin : Double;
NewMax : Double;
NewTicks : Integer;
begin
if FAutoScaleEnabled and not Loading then
begin
case FAutoScaleStyle of
iassAutoMinMax : begin
GetAutoScaleValuesAdjustable(DesiredMin, DesiredMax, FAutoScaleDesiredTicks, FAutoScaleMaxTicks, NewMin, NewMax, NewTicks);
SetPositionMinMax(NewMin, NewMax);
end;
iassFixedMinMax : begin
GetAutoScaleValuesFixed(DesiredMin, DesiredMax, FAutoScaleDesiredTicks, FAutoScaleMaxTicks, NewMin, NewMax, NewTicks);
SetPositionMinMax(DesiredMin, DesiredMax);
FAutoScaleMaxTick := NewMax;
FAutoScaleMinTick := NewMin;
FScaleObject.AutoScaleMaxTick := NewMax;
FScaleObject.AutoScaleMinTick := NewMin;
BackGroundChange;
end;
end;
TickMajorCount := NewTicks;
end;
end;
//****************************************************************************************************************************************************
procedure TiScaleComponent.SetPositionMax(const Value: Double);
begin
if FAutoScaleEnabled and not Loading then
begin
DoAutoScale(PositionMin, Value)
end
else inherited;
end;
//****************************************************************************************************************************************************
procedure TiScaleComponent.SetPositionMin(const Value: Double);
begin
if FAutoScaleEnabled and not Loading then
begin
DoAutoScale(Value, PositionMax)
end
else inherited;
end;
//****************************************************************************************************************************************************
function TiScaleComponent.GetDecimalPoints: Integer;
var
Span : Double;
begin
Result := 0;
case PrecisionStyle of
ipsSignificantDigits : if TickLabelPrecision > 0 then
begin
Span := ABS(PositionMax - PositionMin);
if Span <> 0 then Result := TickLabelPrecision - (Trunc(Log10(Span))+1) else Result := 0;
if Span < 1 then Result := Result + 1;
if Result < 0 then Result := 0;
end;
ipsFixedDecimalPoints : Result := TickLabelPrecision;
end;
end;
//****************************************************************************************************************************************************
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -