- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
Unit2.cpp
上传用户:lulishicai
上传日期:2010-03-01
资源大小:13202k
文件大小:2k
源码类别:
Delphi/CppBuilder
开发平台:
C++ Builder
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "Unit2.h"
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm2 *Form2;
- //---------------------------------------------------------------------------
- __fastcall TForm2::TForm2(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm2::FormCreate(TObject *Sender)
- {
- int i;
- int j;
- //定义变量
- Form2->StringGrid1->ColCount=Form1->VtChart1->ColumnCount+1;
- Form2->StringGrid1->RowCount=Form1->VtChart1->RowCount+1;
- //设置表格的大小
- for (i=0;i<=Form1->VtChart1->ColumnCount;i++)
- {
- Form2->StringGrid1->Cells[i][0]=IntToStr(i);
- }
- for (j=0;j<=Form1->VtChart1->RowCount;j++)
- {
- Form2->StringGrid1->Cells[0][j]=IntToStr(j);
- }
- //设置表格的标题
- for (i=1;i<=Form1->VtChart1->ColumnCount;i++)
- {
- for (j=1;j<=Form1->VtChart1->RowCount;j++)
- {
- Form1->VtChart1->Column=i;
- Form1->VtChart1->Row=j;
- Form2->StringGrid1->Cells[i][j]=Form1->VtChart1->Data;
- //初始化表格中的数据
- }
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm2::Button1Click(TObject *Sender)
- {
- int i;
- int j;
- //变量定义
- for (i=1;i<=Form1->VtChart1->ColumnCount;i++)
- {
- for (j=1;j<=Form1->VtChart1->RowCount;j++)
- {
- Form1->VtChart1->Column=i;
- Form1->VtChart1->Row=j;
- Form1->VtChart1->Data=Form2->StringGrid1->Cells[i][j];
- //以表格中的数据填充图表
- }
- }
- Form1->Show();
- Form2->Hide();
- //显示主窗体
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm2::Button2Click(TObject *Sender)
- {
- Form1->Show();
- Form2->Hide();
- //显示主窗体
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
- {
- Form1->Show();
- //显示主窗体
- }
- //---------------------------------------------------------------------------