📄 gdk.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "gdk.h"
#include "zu.h"
#include <stdlib.h>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm5 *Form5;
//---------------------------------------------------------------------------
__fastcall TForm5::TForm5(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm5::RadioGroup1Exit(TObject *Sender)
{
if( RadioGroup1->ItemIndex ==1){
ComboBox2->Visible=true;
Label2->Visible=true;
ComboBox3->Visible=false;
Label3->Visible=false;
}
else if(RadioGroup1->ItemIndex ==2){
ComboBox3->Visible=true;
Label3->Visible=true;
ComboBox2->Visible=false;
Label2->Visible=false;
}
else{
ComboBox3->Visible=false;
Label3->Visible=false;
ComboBox2->Visible=false;
Label2->Visible=false;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm5::RadioGroup1Click(TObject *Sender)
{
ComboBox1->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm5::FormActivate(TObject *Sender)
{
// ComboBox1->Enabled=false;
for(int i=1;i<=7;i++)
StringGrid1->Cells[0][i]=i;
StringGrid1->Cells[1][0]="星期一";
StringGrid1->Cells[2][0]="星期二";
StringGrid1->Cells[3][0]="星期三";
StringGrid1->Cells[4][0]="星期四";
StringGrid1->Cells[5][0]="星期五";
StringGrid1->Cells[6][0]="星期六";
for(int i=0;i<=41;i++)
StringGrid1->Cells[i/7+1][i%7+1]="";
}
//---------------------------------------------------------------------------
void __fastcall TForm5::StringGrid1DblClick(TObject *Sender)
{
StringGrid1->Cells[StringGrid1->Col][StringGrid1->Row]="";
if(StringGrid1->Col>0&&StringGrid1->Row>0&&StringGrid1->Col<7&&StringGrid1->Row<8)
XSJ("",StringGrid1->Col-1,StringGrid1->Row);
}
//---------------------------------------------------------------------------
void __fastcall TForm5::StringGrid1Click(TObject *Sender)
{
StringGrid1->Cells[StringGrid1->Col][StringGrid1->Row]=ComboBox1->Text;
if(StringGrid1->Col>0&&StringGrid1->Row>0&&StringGrid1->Col<7&&StringGrid1->Row<8)
XSJ(ComboBox1->Text.c_str(),StringGrid1->Col-1,StringGrid1->Row);
}
//---------------------------------------------------------------------------
void __fastcall TForm5::Button1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm5::XSJ(char *kr,int cl,int wo)
{
char *qwe;
qwe=new char[30];
char *fg;
fg=new char[30];
char *fga;
fga=new char[30];
if(RadioGroup1->ItemIndex ==2){
Form2->Table3->IndexName="BJMC";
Form2->Table3->Active = true;
strcpy(qwe,"KCMC");
cl=cl*7+wo;
itoa(cl, fg, 10);
strcat(qwe,fg);
if(Form2->Table3->FindKey(ARRAYOFCONST((ComboBox3->Text)))){
Form2->Table3->Edit();
Form2->Table3->FieldByName(qwe)->AsString=kr;
Form2->Table3->Post();
}
else
ShowMessage("你没有指定要设置固定课的班级。");
}
else if(RadioGroup1->ItemIndex ==0){
Form2->Table3->Active = true;
strcpy(qwe,"KCMC");
cl=cl*7+wo;
itoa(cl, fg, 10);
strcat(qwe,fg);
Form2->Table3->First();
while(!Form2->Table3->Eof){
Form2->Table3->Edit();
Form2->Table3->FieldByName(qwe)->AsString=kr;
Form2->Table3->Next();
};
}
else if(RadioGroup1->ItemIndex ==1){
Form2->Table3->Active = true;
strcpy(qwe,"KCMC");
cl=cl*7+wo;
itoa(cl, fg, 10);
strcat(qwe,fg);
Form2->Table3->First();
strcpy(fg,ComboBox2->Text.c_str());
if(strcmp(fg,"")!=0){
while(!Form2->Table3->Eof){
strcpy(fga,Form2->Table3->FieldByName("BJMC")->AsString.c_str());
if(fga[0]==fg[0]&&fga[1]==fg[1]){
Form2->Table3->Edit();
Form2->Table3->FieldByName(qwe)->AsString=kr;
}
Form2->Table3->Next();
};
}
else
ShowMessage("你没有指定要设置固定课的年级。");
}
delete qwe;
delete fg;
delete fga;
}
void __fastcall TForm5::ComboBox3Change(TObject *Sender)
{
Form2->Table3->IndexName="BJMC";
Form2->Table3->Active = true;
if(Form2->Table3->FindKey(ARRAYOFCONST((ComboBox3->Text)))){
INSA();
char *qwe,*fg;
qwe=new char[20];
fg=new char[5];
for(int cl=0;cl<=41;cl++){
strcpy(qwe,"KCMC");
itoa(cl+1, fg, 10);
strcat(qwe,fg);
StringGrid1->Cells[cl/7+1][cl%7+1]=Form2->Table3->FieldByName(qwe)->AsString;
}
delete qwe;
delete fg;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm5::INSA(void)
{
for(int i=1;i<=7;i++)
StringGrid1->Cells[0][i]=i;
StringGrid1->Cells[1][0]="星期一";
StringGrid1->Cells[2][0]="星期二";
StringGrid1->Cells[3][0]="星期三";
StringGrid1->Cells[4][0]="星期四";
StringGrid1->Cells[5][0]="星期五";
StringGrid1->Cells[6][0]="星期六";
for(int i=0;i<=41;i++)
StringGrid1->Cells[i/7+1][i%7+1]="";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -