Добавлен: 02.04.2023
Просмотров: 464
Скачиваний: 1
СОДЕРЖАНИЕ
1 Теоретические основы организации работы с файлами в MS Visual C++
1.1 Организация работы с файлами средствами C++
1.2 Возможности компонента RichTextBox по работе с файлами
2 Разработка электронного учебника по курсу JavaScript
2.1 Логическая структура приложения
2.4 Разработка программного кода
MessageBox::Show("Для выполнения задания должны быть изучены лекции 4 - 5","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
num=17;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Labs/Lr8.rtf");
}
private: System::Void лабораторнаяРабота9ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для выполнения задания должны быть изучены лекции 5 - 6","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
num=18;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Labs/Lr9.rtf");
}
private: System::Void лабораторнаяРабота10ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для выполнения задания должны быть изучены лекции 5 - 6","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
num=19;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Labs/Lr10.rtf");
}
private: System::Void лабораторнаяРабота11ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для выполнения задания должны быть изучены лекции 6 - 7","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
num=20;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Labs/Lr11.rtf");
}
private: System::Void лабораторнаяРабота12ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для выполнения задания должны быть изучены лекции 6 - 7","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
num=21;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Labs/Lr12.rtf");
}
private: System::Void лабораторнаяРабота13ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для выполнения задания должны быть изучены лекции 7 - 8","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
num=22;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Labs/Lr13.rtf");
}
private: System::Void лабораторнаяРабота14ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для выполнения задания должны быть изучены лекции 7 - 8","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
num=23;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Labs/Lr14.rtf");
}
private: System::Void лабораторнаяРабота15ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для выполнения задания должны быть изучены лекции 8 - 9","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
num=24;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Labs/Lr15.rtf");
}
private: System::Void тест1ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для прохождения теста должны быть изучены лекции 1 - 3","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
int m,n;
this->button1->Enabled=true;
k=0;
this->label1->Visible=false;
this->richTextBox1->Visible=false;
this->richTextBox2->Visible=true;
this->button1->Visible=true;
this->radioButton1->Visible=true;
this->radioButton2->Visible=true;
this->radioButton3->Visible=true;
this->radioButton4->Visible=true;
radioButton1->Checked = false;
radioButton2->Checked = false;
radioButton3->Checked = false;
radioButton4->Checked = false;
i=0;
srand(time(NULL));
m=1+rand()%20;
n=m-1;
this->richTextBox1->LoadFile(L"Test/Test1.rtf");
this->richTextBox2->Text=this->richTextBox1->Lines[6*n];
this->radioButton1->Text=this->richTextBox1->Lines[6*n+1];
this->radioButton2->Text=this->richTextBox1->Lines[6*n+2];
this->radioButton3->Text=this->richTextBox1->Lines[6*n+3];
this->radioButton4->Text=this->richTextBox1->Lines[6*n+4];
o=Convert::ToInt32(this->richTextBox1->Lines[6*n+5]);
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
int n,m;
if ((radioButton1->Checked )&&(o==1)) k=k+1;
if ((radioButton2->Checked )&&(o==2)) k=k+1;
if ((radioButton3->Checked )&&(o==3)) k=k+1;
if ((radioButton4->Checked )&&(o==4)) k=k+1;
radioButton1->Checked = false;
radioButton2->Checked = false;
radioButton3->Checked = false;
radioButton4->Checked = false;
if (i==9)
{
this->richTextBox2->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->button1->Enabled=false;
this->label1->Text="Число правильных ответов - "+Convert::ToString(k)+" из 10";
this->label1->Visible=true;
}
if (i!=9)
{
i=i+1;
srand(time(NULL));
m=1+rand()%20;
n=m-1;
this->richTextBox2->Text=this->richTextBox1->Lines[6*n];
this->radioButton1->Text=this->richTextBox1->Lines[6*n+1];
this->radioButton2->Text=this->richTextBox1->Lines[6*n+2];
this->radioButton3->Text=this->richTextBox1->Lines[6*n+3];
this->radioButton4->Text=this->richTextBox1->Lines[6*n+4];
o=Convert::ToInt32(this->richTextBox1->Lines[6*n+5]);}
}
private: System::Void Form1_Activated(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void Form1_Leave(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void Form1_SizeChanged(System::Object^ sender, System::EventArgs^ e) {
this->richTextBox1->Width=this->Width-31;
this->richTextBox1->Height=this->Height-131;
}
private: System::Void выходToolStripMenuItem_Click_1(System::Object^ sender, System::EventArgs^ e) {
this->Close();
}
private: System::Void оПрограммеToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
About^ f = gcnew About();
f->ShowDialog();
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
if (num==1) {this->richTextBox1->LoadFile(L"Data/Lection2.rtf");}
if (num==2) {this->richTextBox1->LoadFile(L"Data/Lection3.rtf");}
if (num==3) {this->richTextBox1->LoadFile(L"Data/Lection4.rtf");}
if (num==4) {this->richTextBox1->LoadFile(L"Data/Lection5.rtf");}
if (num==5) {this->richTextBox1->LoadFile(L"Data/Lection6.rtf");}
if (num==6) {this->richTextBox1->LoadFile(L"Data/Lection7.rtf");}
if (num==7) {this->richTextBox1->LoadFile(L"Data/Lection8.rtf");}
if (num==8) {this->richTextBox1->LoadFile(L"Data/Lection9.rtf");}
if (num==10) {this->richTextBox1->LoadFile(L"Labs/Lr2.rtf");}
if (num==11) {this->richTextBox1->LoadFile(L"Labs/Lr3.rtf");}
if (num==12) {this->richTextBox1->LoadFile(L"Labs/Lr4.rtf");}
if (num==13) {this->richTextBox1->LoadFile(L"Labs/Lr5.rtf");}
if (num==14) {this->richTextBox1->LoadFile(L"Labs/Lr6.rtf");}
if (num==15) {this->richTextBox1->LoadFile(L"Labs/Lr7.rtf");}
if (num==16) {this->richTextBox1->LoadFile(L"Labs/Lr8.rtf");}
if (num==17) {this->richTextBox1->LoadFile(L"Labs/Lr9.rtf");}
if (num==18) {this->richTextBox1->LoadFile(L"Labs/Lr10.rtf");}
if (num==19) {this->richTextBox1->LoadFile(L"Labs/Lr11.rtf");}
if (num==20) {this->richTextBox1->LoadFile(L"Labs/Lr12.rtf");}
if (num==21) {this->richTextBox1->LoadFile(L"Labs/Lr13.rtf");}
if (num==22) {this->richTextBox1->LoadFile(L"Labs/Lr14.rtf");}
if (num==23) {this->richTextBox1->LoadFile(L"Labs/Lr15.rtf");}
num=num+1;
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
if (num==2) {this->richTextBox1->LoadFile(L"Data/Lection1.rtf");}
if (num==3) {this->richTextBox1->LoadFile(L"Data/Lection2.rtf");}
if (num==4) {this->richTextBox1->LoadFile(L"Data/Lection3.rtf");}
if (num==5) {this->richTextBox1->LoadFile(L"Data/Lection4.rtf");}
if (num==6) {this->richTextBox1->LoadFile(L"Data/Lection5.rtf");}
if (num==7) {this->richTextBox1->LoadFile(L"Data/Lection6.rtf");}
if (num==8) {this->richTextBox1->LoadFile(L"Data/Lection7.rtf");}
if (num==9) {this->richTextBox1->LoadFile(L"Data/Lection8.rtf");}
if (num==11) {this->richTextBox1->LoadFile(L"Labs/Lr1.rtf");}
if (num==12) {this->richTextBox1->LoadFile(L"Labs/Lr2.rtf");}
if (num==13) {this->richTextBox1->LoadFile(L"Labs/Lr3.rtf");}
if (num==14) {this->richTextBox1->LoadFile(L"Labs/Lr4.rtf");}
if (num==15) {this->richTextBox1->LoadFile(L"Labs/Lr5.rtf");}
if (num==16) {this->richTextBox1->LoadFile(L"Labs/Lr6.rtf");}
if (num==17) {this->richTextBox1->LoadFile(L"Labs/Lr7.rtf");}
if (num==18) {this->richTextBox1->LoadFile(L"Labs/Lr8.rtf");}
if (num==19) {this->richTextBox1->LoadFile(L"Labs/Lr9.rtf");}
if (num==20) {this->richTextBox1->LoadFile(L"Labs/Lr10.rtf");}
if (num==21) {this->richTextBox1->LoadFile(L"Labs/Lr11.rtf");}
if (num==22) {this->richTextBox1->LoadFile(L"Labs/Lr12.rtf");}
if (num==23) {this->richTextBox1->LoadFile(L"Labs/Lr13.rtf");}
if (num==24) {this->richTextBox1->LoadFile(L"Labs/Lr14.rtf");}
num=num-1;
}
private: System::Void тест2ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для прохождения теста должны быть изучены лекции 4 - 6","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
int m,n;
this->button1->Enabled=true;
k=0;
this->label1->Visible=false;
this->richTextBox1->Visible=false;
this->richTextBox2->Visible=true;
this->button1->Visible=true;
this->radioButton1->Visible=true;
this->radioButton2->Visible=true;
this->radioButton3->Visible=true;
this->radioButton4->Visible=true;
radioButton1->Checked = false;
radioButton2->Checked = false;
radioButton3->Checked = false;
radioButton4->Checked = false;
i=0;
srand(time(NULL));
m=1+rand()%20;
n=m-1;
this->richTextBox1->LoadFile(L"Test/Test2.rtf");
this->richTextBox2->Text=this->richTextBox1->Lines[6*n];
this->radioButton1->Text=this->richTextBox1->Lines[6*n+1];
this->radioButton2->Text=this->richTextBox1->Lines[6*n+2];
this->radioButton3->Text=this->richTextBox1->Lines[6*n+3];
this->radioButton4->Text=this->richTextBox1->Lines[6*n+4];
o=Convert::ToInt32(this->richTextBox1->Lines[6*n+5]);
}
private: System::Void тест3ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
MessageBox::Show("Для прохождения теста должны быть изучены лекции 7 - 9","Внимание!", MessageBoxButtons::OK,MessageBoxIcon::Question);
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
int m,n;
this->button1->Enabled=true;
k=0;
this->label1->Visible=false;
this->richTextBox1->Visible=false;
this->richTextBox2->Visible=true;
this->button1->Visible=true;
this->radioButton1->Visible=true;
this->radioButton2->Visible=true;
this->radioButton3->Visible=true;
this->radioButton4->Visible=true;
radioButton1->Checked = false;
radioButton2->Checked = false;
radioButton3->Checked = false;
radioButton4->Checked = false;
i=0;
srand(time(NULL));
m=1+rand()%20;
n=m-1;
this->richTextBox1->LoadFile(L"Test/Test3.rtf");
this->richTextBox2->Text=this->richTextBox1->Lines[6*n];
this->radioButton1->Text=this->richTextBox1->Lines[6*n+1];
this->radioButton2->Text=this->richTextBox1->Lines[6*n+2];
this->radioButton3->Text=this->richTextBox1->Lines[6*n+3];
this->radioButton4->Text=this->richTextBox1->Lines[6*n+4];
o=Convert::ToInt32(this->richTextBox1->Lines[6*n+5]);
}
private: System::Void button2_Click_1(System::Object^ sender, System::EventArgs^ e) {
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Data/Lection1.rtf");
num=1;
}
private: System::Void button3_Click_1(System::Object^ sender, System::EventArgs^ e) {
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Data/Lection2.rtf");
num=1;
}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Data/Lection3.rtf");
num=1;
}
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Data/Lection4.rtf");
num=1;
}
private: System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) {
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Data/Lection5.rtf");
num=1;
}
private: System::Void button7_Click(System::Object^ sender, System::EventArgs^ e) {
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;
this->radioButton4->Visible=false;
this->label1->Visible=false;
this->richTextBox1->LoadFile(L"Data/Lection6.rtf");
num=1;
}
private: System::Void button8_Click(System::Object^ sender, System::EventArgs^ e) {
this->groupBox1->Visible=false;
this->groupBox2->Visible=false;
this->groupBox3->Visible=false;
this->richTextBox1->Visible=true;
this->richTextBox2->Visible=false;
this->button1->Visible=false;
this->radioButton1->Visible=false;
this->radioButton2->Visible=false;
this->radioButton3->Visible=false;