⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xchartf.pas

📁 外国人写的各种类型的源代码,有兴趣的朋友看看吧!是学习的好东西哟
💻 PAS
字号:
unit XChartF;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtrls, vcfi, Grids, StdCtrls;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    UpdateButton: TButton;
    Label5: TLabel;
    ComboBox1: TComboBox;
    VtChart1: TVtChart;
    procedure FormCreate(Sender: TObject);
    procedure UpdateButtonClick(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure StringGrid1GetEditMask(Sender: TObject; ACol, ARow: Longint;
      var Value: string);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
  I, J: Integer;
begin
  with StringGrid1 do
  begin
    {fills the fixed column and row}
    for I := 1 to 5 do
      Cells [I, 0] := Format ('R%d:', [I]);
    for J := 1 to 4 do
      Cells [0, J] := Format ('C%d:', [J]);
    {fills the grid with random values}
    Randomize;
    for I := 1 to 5 do
      for J := 1 to 4 do
        Cells [I, J] := IntToStr (Random (100));
  end;

  {update the chart}
  UpdateButtonClick (self);

  {select the initial style in the combo box}
  ComboBox1.ItemIndex := VtChart1.ChartType;
end;

procedure TForm1.UpdateButtonClick(Sender: TObject);
var
  I, J: Integer;
begin
  for I := 1 to 5 do
  begin
    VtChart1.Row := I;
    for J := 1 to 4 do
    begin
      VtChart1.Column := J;
      VtChart1.Data := StringGrid1.Cells [I, J];
    end;
  end;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  {change the type of chart}
  VtChart1.ChartType := ComboBox1.ItemIndex;
end;

procedure TForm1.StringGrid1GetEditMask(Sender: TObject; ACol,
  ARow: Longint; var Value: string);
begin
  Value := '!09';
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -