Unit1.cpp
上传用户:lulishicai
上传日期:2010-03-01
资源大小:13202k
文件大小:2k
源码类别:

Delphi/CppBuilder

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. #include "Unit2.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma resource "*.dfm"
  9. TForm1 *Form1;
  10. //---------------------------------------------------------------------------
  11. __fastcall TForm1::TForm1(TComponent* Owner)
  12.         : TForm(Owner)
  13. {
  14. }
  15. //---------------------------------------------------------------------------
  16. void __fastcall TForm1::FormCreate(TObject *Sender)
  17. {
  18. Form1->VtChart1->RandomFill;
  19. //随机填充图表
  20. Form1->ComboBox1->Items->Add("VtChChartType3dBar");
  21. Form1->ComboBox1->Items->Add("VtChChartType2dBar");
  22. Form1->ComboBox1->Items->Add("VtChChartType3dLine");
  23. Form1->ComboBox1->Items->Add("VtChChartType2dLine");
  24. Form1->ComboBox1->Items->Add("VtChChartType3dArea");
  25. Form1->ComboBox1->Items->Add("VtChChartType2dArea");
  26. Form1->ComboBox1->Items->Add("VtChChartType3dStep");
  27. Form1->ComboBox1->Items->Add("VtChChartType2dStep");
  28. Form1->ComboBox1->Items->Add("VtChChartType3dCombination");
  29. Form1->ComboBox1->Items->Add("VtChChartType2dCombination");
  30. Form1->ComboBox1->Items->Add("VtChChartType3dHorizontalBar");
  31. Form1->ComboBox1->Items->Add("VtChChartType2dHorizontalBar");
  32. Form1->ComboBox1->Items->Add("VtChChartType3dClusteredBar");
  33. Form1->ComboBox1->Items->Add("VtChChartType3dPie");
  34. Form1->ComboBox1->Items->Add("VtChChartType2dPie");
  35. //填充列表项
  36. Form1->VtChart1->ChartType=0;
  37. //设置图表类型
  38. }
  39. //---------------------------------------------------------------------------
  40. void __fastcall TForm1::Button1Click(TObject *Sender)
  41. {
  42. Form1->Hide();
  43. //隐藏主窗体
  44. Form1->VtChart1->UseWizard();
  45. //显示向导程序
  46. Form1->Show(); 
  47. }
  48. //---------------------------------------------------------------------------
  49. void __fastcall TForm1::Button2Click(TObject *Sender)
  50. {
  51. Form1->Hide();
  52. Form2->Show();
  53. //显示数据赋值窗体
  54. }
  55. //---------------------------------------------------------------------------
  56. void __fastcall TForm1::Button3Click(TObject *Sender)
  57. {
  58. Form1->VtChart1->RandomFill;
  59. //随机填充图表
  60. }
  61. //---------------------------------------------------------------------------
  62. void __fastcall TForm1::ComboBox1Click(TObject *Sender)
  63. {
  64. Form1->VtChart1->ChartType=Form1->ComboBox1->ItemIndex;
  65. //对图表使用当前选中的图表类型
  66. }
  67. //---------------------------------------------------------------------------
  68.