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

📄 main.cpp

📁 员工管理系统读您的文件包然后写出其具体功能(至少要20个字)。尽量不要让站长把时间都花费在为您
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "main.h"
#include "login.h"
#include "employeeseek.h"
#include "Query.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"

TMainForm *MainForm;

//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
        : TForm(Owner)
{    


}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------

void __fastcall TMainForm::N5Click(TObject *Sender)
{
       Close();
}
//---------------------------------------------------------------------------




//---------------------------------------------------------------------------

void __fastcall TMainForm::FormShow(TObject *Sender)
{
   loginok=false;
   Fm_login->ShowModal(); //调用登录窗体
   if(!loginok)
   Close();
}
//---------------------------------------------------------------------------
/*
void __fastcall TMainForm::DBGridToExcel(TDBGrid *dbg, String strXlsFile)
{
    Variant vExcelApp, vSheet;
    try
    {
      vExcelApp = Variant::CreateObject("Excel.Application");
    }
    catch(...)
    {
      MessageBox(0, "启动 Excel 出错, 可能是没有安装Excel.","DBGridToExcel", MB_OK | MB_ICONERROR);
      return;
    }
    // 隐藏Excel界面
    vExcelApp.OlePropertySet("Visible", false);
    // 新建一个工作表
    vExcelApp.OlePropertyGet("Workbooks").OleFunction("Add",1);
    // 操作这个工作表
    vSheet = vExcelApp.OlePropertyGet("ActiveWorkbook").OlePropertyGet("Sheets",1);

    // 设置Excel文档的字体
    vSheet.OleProcedure("Select");
    vSheet.OlePropertyGet("Cells").OleProcedure("Select");
    vExcelApp.OlePropertyGet("Selection").OlePropertyGet("Font").OlePropertySet("Size", dbg->Font->Size);
    vExcelApp.OlePropertyGet("Selection").OlePropertyGet("Font").OlePropertySet("Name", dbg->Font->Name.c_str());
    vExcelApp.OlePropertyGet("Selection").OlePropertyGet("Font").OlePropertySet("FontStyle", "常规");
    vExcelApp.OlePropertyGet("Selection").OlePropertySet("NumberFormatLocal", "@");
    vSheet.OlePropertyGet("Cells",1,1).OleProcedure("Select");
    // 表格的行数
    int nRowCount(dbg->DataSource->DataSet->RecordCount+1);
    nRowCount = nRowCount < 2? 2: nRowCount;
    // 表格的列数
    int nColCount(dbg->Columns->Count);
    nColCount = nColCount < 1? 1: nColCount;
    // 设置单元格的宽度
    for(int i=0;i<nColCount;i++)
    {
      int nColWidth = dbg->Columns->Items[i]->Width;
      vExcelApp.OlePropertyGet("Columns",i+1).OlePropertySet("ColumnWidth", nColWidth/7);
    }

    // 将列名写入Excel表格
    for(int j=0;j<dbg->Columns->Count;j++)
    {
      // 标题行的行高
      vExcelApp.OlePropertyGet("Rows",1).OlePropertySet("RowHeight",16);
      // 写入标题
      vSheet.OlePropertyGet("Cells",1,j+1).OlePropertySet("Value",dbg->Columns->Items[j]->Title->Caption.c_str());
    }

    // 将DBGrid中的数据写入Excel表格
    dbg->DataSource->DataSet->First();
    for(int i=0; i<nRowCount-1; i++)
    {
      // 设置数据行的行高
      vExcelApp.OlePropertyGet("Rows",i+2).OlePropertySet("RowHeight", 16);
      // 写入某行的每列数据
      for(int j=0; j<dbg->Columns->Count; j++)
        vExcelApp.Exec(PropertyGet("Cells")<<i+2<<j+1).Exec(PropertySet("Value")<<dbg->DataSource->DataSet->FieldByName(dbg->Columns->Items[j]->FieldName)->AsString);
      dbg->DataSource->DataSet->Next();
    }

    // 保存Excel文档并退出
    vExcelApp.OlePropertyGet("ActiveWorkbook").OleFunction("SaveAs", strXlsFile.c_str());
    vExcelApp.OleFunction("Quit");
    vSheet = Unassigned;
    vExcelApp = Unassigned;
}





           */




void __fastcall TMainForm::N7Click(TObject *Sender)
{
    Fm_employeeseek->Show();
}
//---------------------------------------------------------------------------

void __fastcall TMainForm::N6Click(TObject *Sender)
{
   Fm_employee->Show();
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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