unit1.cpp
来自「C++ Builder 6 编程实例教程-北京希望电子出版社出版」· C++ 代码 · 共 74 行
CPP
74 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Form1->VtChart1->RandomFill;
//随机填充图表
Form1->ComboBox1->Items->Add("VtChChartType3dBar");
Form1->ComboBox1->Items->Add("VtChChartType2dBar");
Form1->ComboBox1->Items->Add("VtChChartType3dLine");
Form1->ComboBox1->Items->Add("VtChChartType2dLine");
Form1->ComboBox1->Items->Add("VtChChartType3dArea");
Form1->ComboBox1->Items->Add("VtChChartType2dArea");
Form1->ComboBox1->Items->Add("VtChChartType3dStep");
Form1->ComboBox1->Items->Add("VtChChartType2dStep");
Form1->ComboBox1->Items->Add("VtChChartType3dCombination");
Form1->ComboBox1->Items->Add("VtChChartType2dCombination");
Form1->ComboBox1->Items->Add("VtChChartType3dHorizontalBar");
Form1->ComboBox1->Items->Add("VtChChartType2dHorizontalBar");
Form1->ComboBox1->Items->Add("VtChChartType3dClusteredBar");
Form1->ComboBox1->Items->Add("VtChChartType3dPie");
Form1->ComboBox1->Items->Add("VtChChartType2dPie");
//填充列表项
Form1->VtChart1->ChartType=0;
//设置图表类型
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Form1->Hide();
//隐藏主窗体
Form1->VtChart1->UseWizard();
//显示向导程序
Form1->Show();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Form1->Hide();
Form2->Show();
//显示数据赋值窗体
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Form1->VtChart1->RandomFill;
//随机填充图表
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox1Click(TObject *Sender)
{
Form1->VtChart1->ChartType=Form1->ComboBox1->ItemIndex;
//对图表使用当前选中的图表类型
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?