背单词软件C++实现
整体考虑程序应该实现的功能,有单词选意、中文选词、选词填空、全拼练习和退出程序一共5个功能。
首先建立一个主窗体,在窗体上增加五个按钮控件,其Text属性分别为英文选意、中文选词、选词填空、全拼练习和退出系统。在主窗体的头文件中添加以下代码:
//添加包含指令
#include"BDC2.h"
#include"BDC3.h"
#include"BDC4.h"
#include"BDC5.h"
//“打开窗口2”按钮事件函数
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
BDC2^f2=gcnew BDC2();
f2->StartPosition=FormStartPosition::WindowsDefaultLocation;
f2->TopMost=true;
f2->Opacity=100;
f2->Show();
}
//“打开窗口3”按钮事件函数
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
BDC3^f3=gcnew BDC3();
f3->StartPosition=FormStartPosition::WindowsDefaultLocation;
f3->TopMost=true;
f3->Opacity=100;
f3->Show();
}
//“打开窗口4”按钮事件函数
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
BDC4^f4=gcnew BDC4();
f4->StartPosition=FormStartPosition::WindowsDefaultLocation;
f4->TopMost=true;
f4->Opacity=100;
f4->Show();
}
//“打开窗口5”按钮事件函数
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
BDC5^f5=gcnew BDC5();
f5->StartPosition=FormStartPosition::WindowsDefaultLocation;
f5->TopMost=true;
f5->Opacity=100;
f5->Show();
}
1