Смекни!
smekni.com

Автоматизация расчёта нагрузки и преподавателей ВУЗа (стр. 5 из 5)

void __fastcall TForm4::N18Click(TObject *Sender)

{

Form8=new TForm8(Application);

Form8->Show();

}

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

void __fastcall TForm4::FormCreate(TObject *Sender)

{

GroupBox1->Visible=false;

ProgressBar1->Visible=false;

Table1->FilterOptions>>foNoPartialCompare;

Table1->FilterOptions<<foCaseInsensitive;

}

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

void __fastcall TForm4::N19Click(TObject *Sender)

{

GroupBox1->Visible=false;

}

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

void __fastcall TForm4::N20Click(TObject *Sender)

{

Panel1->Visible=false;

}

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

void __fastcall TForm4::N8Click(TObject *Sender)

{

Form6=new TForm6(Application);

Form6->Show();

}

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

void __fastcall TForm4::N1Click(TObject *Sender)

{

GroupBox1->Visible=true;

}

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

void __fastcall TForm4::CheckBox1Click(TObject *Sender)

{

if (!CheckBox1->Checked)

Table1->Filtered=false;

}

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

void __fastcall TForm4::Edit2Change(TObject *Sender)

{float m;

String StrFiltr;

if (CheckBox1->Checked)

{Table1->Filtered=false;

Table1->Refresh();

StrFiltr=Edit2->Text+"*";

if (ListBox1->Items->Strings[ListBox1->ItemIndex]=="FIO")

{Table1->Filter="FIO='"+StrFiltr+"'";}

else

{if (ListBox1->Items->Strings[ListBox1->ItemIndex]=="God")

Table1->Filter="God='"+FloatToStr(m)+"'";

else {if (ListBox1->Items->Strings[ListBox1->ItemIndex]=="Pol")

Table1->Filter="Pol='"+StrFiltr+"'";

else {if (ListBox1->Items->Strings[ListBox1->ItemIndex]=="Spec")

Table1->Filter="Spec='"+StrFiltr+"'";

else

Table1->Filter="Group='"+StrFiltr+"'";}}}}

{

Table1->Filtered=true;}

}

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

void __fastcall TForm4::N13Click(TObject *Sender)

{

GroupBox1->Visible=false;

}

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

Листинг формы «О программе»

#include <vcl.h>

#pragma hdrstop

#include "Unit3.h"

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

#pragma resource "*.dfm"

TForm7 *Form7;

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

__fastcall TForm7::TForm7(TComponent* AOwner)

: TForm(AOwner)

{

}

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

void __fastcall TForm7::OKButtonClick(TObject *Sender)

{

Form7->Close();

}

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

Листинг формы «Текстовый редактор»

#include <vcl.h>

#pragma hdrstop

#include "uni.h"

#include "Unit3.h"

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

#pragma resource "*.dfm"

TForm3 *Form3;

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

__fastcall TForm3::TForm3(TComponent* AOwner)

: TForm(AOwner)

{

}

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

void __fastcall TForm3::SpeedButton1Click(TObject *Sender)

{

if (OpenDialog1->Execute())

{Memo1->Lines->LoadFromFile(OpenDialog1->FileName);

StatusBar1->Panels->Items[0]->Text=OpenDialog1->FileName;

}

}

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

void __fastcall TForm3::SpeedButton3Click(TObject *Sender)

{

if (Memo1->Lines->Count>0)

{

if (MessageBox(0,"Ñîõðàíèòü ñîäåðæèìîå îêíà ðåäàêòèðîâàíèÿ? ","Ïîäòâåðäèòå ñîõðàíåíèå",MB_YESNO)==IDYES)

{

SpeedButton4Click(Sender);

}

}

Memo1->Clear();

StatusBar1->Panels->Items[0]->Text="Áåç èìåíè";

}

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

void __fastcall TForm3::SpeedButton5Click(TObject *Sender)

{

if (StatusBar1->Panels->Items[0]->Text=="Áåç èìåíè")

SpeedButton4Click(Sender);

else

{Memo1->Lines->SaveToFile(StatusBar1->Panels->Items[0]->Text); }

}

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

void __fastcall TForm3::SpeedButton2Click(TObject *Sender)

{

SpeedButton3Click(Sender);

Close();

}

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

void __fastcall TForm3::SpeedButton4Click(TObject *Sender)

{

if (SaveDialog1->Execute())

Memo1->Lines->SaveToFile(SaveDialog1->FileName);

StatusBar1->Panels->Items[0]->Text=SaveDialog1->FileName;

}

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

void __fastcall TForm3::SpeedButton6Click(TObject *Sender)

{

Memo1->CutToClipboard();

}

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

void __fastcall TForm3::SpeedButton7Click(TObject *Sender)

{

Memo1->CopyToClipboard();

}

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

void __fastcall TForm3::SpeedButton8Click(TObject *Sender)

{

Memo1->PasteFromClipboard();

}

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

void __fastcall TForm3::SpeedButton9Click(TObject *Sender)

{

Form7=new TForm7(Application);

Form7->Show();

}

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

Листинг формы «Создание расписания»

#include<vcl.h>

#pragma hdrstop

#include "Unit7.h"

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

#pragma resource "*.dfm"

TForm6 *Form6;

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

__fastcall TForm6::TForm6(TComponent* AOwner)

: TForm(AOwner)

{

}

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

void __fastcall TForm6::CancelBtnClick(TObject *Sender)

{

Table1->Cancel();

Form6->Close();

}

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

void __fastcall TForm6::OKBtnClick(TObject *Sender)

{

Table1->Post();

Form6->Close();

}

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

void __fastcall TForm6::Button1Click(TObject *Sender)

{

Table1->Bof;

while (Table1->Eof)

{Table1->Next();

}

TForm* GridForm=new TForm((TComponent *)NULL);

GridForm->Caption="Расписание";

GridForm->Width=300;

GridForm->Height=300;

TStringGrid *Grid=new TStringGrid(GridForm);

Grid->ColCount=Table1->FieldCount;

Grid->RowCount=Table1->FieldCount;

Grid->Parent=GridForm;

Grid->Align=alClient;

GridForm->Show();

Grid->FixedCols=1;

Grid->FixedRows=1;

Grid->Cells[0][1]="8.20";

Grid->Cells[0][2]="10.00";

Grid->Cells[0][3]="11.45";

Grid->Cells[0][4]="13.20";

Grid->Cells[0][5]="15.00";

Grid->Cells[0][6]="16.45";

Grid->Cells[0][7]="18.00";

Grid->Cells[0][8]="19.45";

Grid->Cells[1][0]="Понедельник";

Grid->Cells[2][0]="Вторник";

Grid->Cells[3][0]="Среда";

Grid->Cells[4][0]="Четверг";

Grid->Cells[5][0]="Пятница";

Grid->Show();

GridForm->Handle;

String StrFiltr;

Table1->Filtered=false;

Table1->Refresh();

StrFiltr=ListBox1->Items->Strings[ListBox1->ItemIndex]+"*";

Table1->Filter="FIO1='"+StrFiltr+"'";

Table1->Filtered=true;

int i;

while (!Table1->Eof)

{for (i=1;i<Table1->FieldCount;i++)

{if (Table1Time->Value==Grid->Cells[0][i])

Grid->Cells[1][i]=Table1Group->Value+Table1N1->Value;}

Table1->Next();

}

Table1->Filtered=false;

Table1->Bof;

Table1->Filter="FIO2='"+StrFiltr+"'";

Table1->Filtered=true;

while (!Table1->Eof)

{for (i=1;i<Table1->FieldCount;i++)

{if (Table1Time->Value==Grid->Cells[0][i])

Grid->Cells[2][i]=Table1Group->Value+Table1N2->Value;}

Table1->Next();}

Table1->Filtered=false;

Table1->Bof;

Table1->Filter="FIO3='"+StrFiltr+"'";

Table1->Filtered=true;

while (!Table1->Eof)

{for (i=1;i<Table1->FieldCount;i++)

{if (Table1Time->Value==Grid->Cells[0][i])

Grid->Cells[3][i]=Table1Group->Value+Table1N3->Value;}

Table1->Next();}

Table1->Filtered=false;

Table1->Bof;

Table1->Filter="FIO4='"+StrFiltr+"'";

Table1->Filtered=true;

while (!Table1->Eof)

{for (i=1;i<Table1->FieldCount;i++)

{if (Table1Time->Value==Grid->Cells[0][i])

Grid->Cells[4][i]=Table1Group->Value+Table1N4->Value;}

Table1->Next();}

Table1->Filtered=false;

Table1->Bof;

Table1->Filter="FIO5='"+StrFiltr+"'";

Table1->Filtered=true;

while (!Table1->Eof)

{for (i=1;i<Table1->FieldCount;i++)

{if (Table1Time->Value==Grid->Cells[5][i])

Grid->Cells[5][i]=Table1Group->Value+Table1N5->Value;}

Table1->Next();}

}

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

void __fastcall TForm6::Button2Click(TObject *Sender)

{

RichEdit1->Lines->LoadFromFile(ListBox2->Items->Strings[ListBox2->ItemIndex]+".txt");

}

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

void __fastcall TForm6::Edit1Change(TObject *Sender)

{

String StrFiltr;

Table1->Filtered=false;

Table1->Refresh();

StrFiltr=Edit1->Text+"*";

Table1->Filter="Group='"+StrFiltr+"'";

if (CheckBox1->Checked)

Table1->Filtered=true;

}

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