📄 teegried.pas
字号:
if Assigned(Grid3D) and Assigned(Grid3D.ParentChart) then
{$IFNDEF CLR}TTeePanelAccess{$ENDIF}(Grid3D.ParentChart).RemoveListener(Self);
end;
procedure TGrid3DSeriesEditor.TeeEvent(Event: TTeeEvent);
begin
if not (csDestroying in ComponentState) then
if Event is TTeeSeriesEvent then
With TTeeSeriesEvent(Event) do
if Event=seChangeColor then BColor.Invalidate;
end;
procedure TGrid3DSeriesEditor.PageControl1Change(Sender: TObject);
begin
if not Creating then
begin
if PageControl1.ActivePage=TabSingle then
begin
With Grid3D do
begin
ColorEachPoint:=True;
ColorEachPoint:=False;
UseColorRange:=False;
UsePalette:=False;
end;
end
else
if PageControl1.ActivePage=TabRange then
begin
Grid3D.UseColorRange:=True;
Grid3D.UsePalette:=False;
end
else
begin
Grid3D.UseColorRange:=False;
Grid3D.UsePalette:=True;
if Grid3D.PaletteStyle<>psCustom then
Grid3D.ClearPalette;
UpdatePalette;
end;
end;
end;
procedure TGrid3DSeriesEditor.CBUseMinClick(Sender: TObject);
begin
Grid3D.UsePaletteMin:=CBUseMin.Checked;
EPaletteMin.Enabled:=Grid3D.UsePaletteMin;
end;
procedure TGrid3DSeriesEditor.EPaletteMinChange(Sender: TObject);
begin
if not Creating then
with Grid3D do PaletteMin:=StrToFloatDef(EPaletteMin.Text,PaletteMin);
end;
procedure TGrid3DSeriesEditor.EPaletteStepChange(Sender: TObject);
begin
if not Creating then
with Grid3D do PaletteStep:=StrToFloatDef(EPaletteStep.Text,PaletteStep);
end;
procedure TGrid3DSeriesEditor.Button1Click(Sender: TObject);
var tmp : TColor;
begin
with Grid3D do
begin
tmp:=StartColor;
StartColor:=EndColor;
EndColor:=tmp;
end;
BFromColor.Invalidate;
BToColor.Invalidate;
end;
procedure TGrid3DSeriesEditor.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
begin
Grid3D.MidColor:=clNone;
BMidColor.Repaint;
end;
CheckBox1.Enabled:=not CheckBox1.Checked;
end;
procedure TGrid3DSeriesEditor.CheckMidColor;
begin
CheckBox1.Checked:=Grid3D.MidColor=clNone;
CheckBox1.Enabled:=not CheckBox1.Checked;
end;
procedure TGrid3DSeriesEditor.BMidColorClick(Sender: TObject);
begin
CheckMidColor;
end;
procedure TGrid3DSeriesEditor.Edit1Change(Sender: TObject);
begin
if not Creating then
with Grid3D do LegendEvery:=UDLegendEvery.Position;
end;
procedure TGrid3DSeriesEditor.BRemoveClick(Sender: TObject);
var t : Integer;
begin
with Grid3D do
for t:=0 to Count-1 do ValueColor[t]:=clTeeColor;
BRemove.Enabled:=False;
end;
procedure TGrid3DSeriesEditor.Timer1Timer(Sender: TObject);
var Old : TTabSheet;
begin
Timer1.Enabled:=False;
Old:=PageControl1.ActivePage;
PageControl1.ActivePage:=nil;
PageControl1.ActivePage:=Old;
end;
procedure TGrid3DSeriesEditor.Button2Click(Sender: TObject);
var tmpS : TColor;
tmpM : TColor;
tmpE : TColor;
begin
tmpS:=Grid3D.StartColor;
tmpM:=Grid3D.MidColor;
tmpE:=Grid3D.EndColor;
if EditGradientColors(tmpS,tmpM,tmpE,True) then
begin
Grid3D.StartColor:=tmpS;
Grid3D.MidColor:=tmpM;
Grid3D.EndColor:=tmpE;
BFromColor.Invalidate;
BMidColor.Invalidate;
BToColor.Invalidate;
CheckMidColor;
end;
end;
function TGrid3DSeriesEditor.EditGradientColors(var AStart,AMid,AEnd:TColor;
HideTabColors:Boolean):Boolean;
var tmp : TTeeGradient;
Function EditedGradient:Boolean;
var tmpEd : TTeeGradientEditor;
begin
tmpEd:=TTeeGradientEditor.Create(Self);
with tmpEd do // 7.0
try
Align:=alNone;
// PositionToCenter(tmpEd); <-- VCL bug when setting TabVisible:=False below
RefreshGradient(tmp);
Panel2.Hide;
if HideTabColors then
TabSheet1.TabVisible:=False;
TabSheet2.TabVisible:=False;
TabSheet4.TabVisible:=False;
TabSheet5.TabVisible:=False;
result:=ShowModal=mrOk;
finally
Free;
end;
end;
begin
result:=False;
tmp:=TTeeGradient.Create(nil);
try
tmp.Visible:=True;
tmp.StartColor:=AStart;
tmp.MidColor:=AMid;
tmp.EndColor:=AEnd;
if EditedGradient then
begin
AStart:=tmp.StartColor;
AMid:=tmp.MidColor;
AEnd:=tmp.EndColor;
result:=True;
end;
finally
tmp.Free;
end;
end;
procedure TGrid3DSeriesEditor.CBPalettesChange(Sender: TObject);
begin
ApplyPalette(Grid3D,CBPalettes.ItemIndex);
UpdatePalette;
end;
class procedure TGrid3DSeriesEditor.ApplyPalette(Series:TCustom3DPaletteSeries;
Index:Integer);
begin
case Index of
0: Series.AddPalette(TeeProcs.ColorPalette);
1: Series.AddPalette(ExcelPalette);
2: Series.AddPalette(VictorianPalette);
3: Series.AddPalette(PastelsPalette);
4: Series.AddPalette(SolidPalette);
5: Series.AddPalette(ClassicPalette);
6: Series.AddPalette(WebPalette);
7: Series.AddPalette(ModernPalette);
8: Series.AddPalette(RainbowPalette);
9: Series.AddPalette(WindowsXPPalette);
10: Series.AddPalette(MacOSPalette);
11: Series.AddPalette(WindowsVistaPalette);
12: Series.AddPalette(GrayScalePalette);
13: Series.AddPalette(OperaPalette);
14: Series.AddPalette(WarmPalette);
15: Series.AddPalette(CoolPalette);
end;
end;
procedure TGrid3DSeriesEditor.ChartGrid1ChangeColor(Sender: TObject);
var Index : Integer;
begin
Index:=ChartGrid1.Row-ChartGrid1.FirstRowNum;
Grid3D.Palette[Index].Color:=PaletteSeries.ValueColor[Index];
Grid3D.Repaint;
end;
procedure TGrid3DSeriesEditor.ChartGrid1EditingCell(
Sender: TCustomChartGrid; ACol, ARow: Integer; var Allow: Boolean);
begin
Allow:=ACol=Sender.ColorsColumn;
end;
type
TCustom3DPaletteAccess=class(TCustom3DPaletteSeries);
procedure TGrid3DSeriesEditor.Button3Click(Sender: TObject);
var tmpS : TColor;
tmpM : TColor;
tmpE : TColor;
tmpOldS : TColor;
tmpOldM : TColor;
tmpOldE : TColor;
begin
tmpS:=clRed;
tmpM:=clYellow;
tmpE:=clGreen;
if EditGradientColors(tmpS,tmpM,tmpE,False) then
begin
Grid3D.UsePalette:=False;
Grid3D.UseColorRange:=True;
tmpOldS:=Grid3D.StartColor;
tmpOldM:=Grid3D.MidColor;
tmpOldE:=Grid3D.EndColor;
Grid3D.StartColor:=tmpS;
Grid3D.MidColor:=tmpM;
Grid3D.EndColor:=tmpE;
TCustom3DPaletteAccess(Grid3D).GeneratePalette;
Grid3D.StartColor:=tmpOldS;
Grid3D.MidColor:=tmpOldM;
Grid3D.EndColor:=tmpOldE;
Grid3D.UseColorRange:=False;
Grid3D.UsePalette:=True;
SetCustomPalette;
end;
end;
procedure TGrid3DSeriesEditor.SetCustomPalette;
begin
Grid3D.PaletteStyle:=psCustom;
CBPalStyle.ItemIndex:=Ord(Grid3D.PaletteStyle);
CBPalettes.ItemIndex:=-1;
UpdatePalette;
end;
procedure TGrid3DSeriesEditor.Invert1Click(Sender: TObject);
begin
Grid3D.InvertPalette;
SetCustomPalette;
end;
procedure TGrid3DSeriesEditor.Button4Click(Sender: TObject);
begin
Invert1Click(Self);
end;
initialization
RegisterClass(TGrid3DSeriesEditor);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -