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

📄 impdlgf.cpp

📁 Advanced Data Import Component Suite for Borland Delphi and C++ Builder allows you to import your da
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "ImpDlgF.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "QImport3Wizard"
#pragma resource "*.dfm"
TfmImpDlg *fmImpDlg;
//---------------------------------------------------------------------------
__fastcall TfmImpDlg::TfmImpDlg(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfmImpDlg::FormCreate(TObject *Sender)
{
  Table1->TableName = "country";
  Table1->Active = True;
}
//---------------------------------------------------------------------------
void __fastcall TfmImpDlg::FormDestroy(TObject *Sender)
{
  Table1->Active = False;
}
//---------------------------------------------------------------------------
void __fastcall TfmImpDlg::btImportClick(TObject *Sender)
{
  QImportWizard1->Execute();
}
//---------------------------------------------------------------------------
void __fastcall TfmImpDlg::QImportWizard1AfterImport(TObject *Sender)
{
  Table1->Close();
  Table1->Open();
}
//---------------------------------------------------------------------------
void __fastcall TfmImpDlg::QImportWizard1BeforePost(TObject *Sender,
  TQImportRow *Row, bool &Accept)
{
  if (chbUseBeforePost->Checked)
    for (int i = 0; i <= Row->Count - 1; i++)
      if (Row->Items[i]->Value == "Argentina")
      {
        Accept = false;
        return;
      }
}
//---------------------------------------------------------------------------
void __fastcall TfmImpDlg::Button1Click(TObject *Sender)
{
  if ((pcDestinations->ActivePage == tshDataSet) ||
      (pcDestinations->ActivePage == tshDBGrid))
  {
    Table1->Close();
    try
    {
      Table1->Exclusive = true;
      try
      {
        Table1->EmptyTable();
      }
      __finally
      {
        Table1->Exclusive = false;
      }
    }
    __finally
    {
      Table1->Open();
    }
  }
  else if (pcDestinations->ActivePage == tshListView)
  {
    ListView->Items->BeginUpdate();
    try
    {
      ListView->Items->Clear();
    }
    __finally
    {
      ListView->Items->EndUpdate();
    }
  }
  else if (pcDestinations->ActivePage == tshStringGrid)
  {
    for (int i = 1; i <= StringGrid->RowCount - 1; i++)
      for (int j = 0; j <= StringGrid->ColCount - 1; j++)
        StringGrid->Cells[j][i] = EmptyStr;
  }
}
//---------------------------------------------------------------------------
void __fastcall TfmImpDlg::pcDestinationsChange(TObject *Sender)
{
  if (pcDestinations->ActivePage == tshDataSet)
    QImportWizard1->ImportDestination = qidDataSet;
  else if (pcDestinations->ActivePage == tshDBGrid)
    QImportWizard1->ImportDestination = qidDBGrid;
  else if (pcDestinations->ActivePage == tshListView)
    QImportWizard1->ImportDestination = qidListView;
  else if (pcDestinations->ActivePage == tshStringGrid) 
    QImportWizard1->ImportDestination = qidStringGrid;
}

⌨️ 快捷键说明

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