:
String^>^args)
{
//在创建任何控件之前启用WindowsXP可视化效果
Application:
:
EnableVisualStyles();
Application:
:
SetCompatibleTextRenderingDefault(false);
//创建主窗口并运行它
Application:
:
Run(gcnewForm1());
return0;
}
Form1.h库中的源代码:
#pragmaonce
#include
namespacemorse{
usingnamespaceSystem;
usingnamespaceSystem:
:
ComponentModel;
usingnamespaceSystem:
:
Collections;
usingnamespaceSystem:
:
Windows:
:
Forms;
usingnamespaceSystem:
:
Data;
usingnamespaceSystem:
:
Drawing;
usingnamespaceSystem:
:
Runtime:
:
InteropServices;
///
///Form1摘要
///
publicrefclassForm1:
publicSystem:
:
Windows:
:
Forms:
:
Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO:
在此处添加构造函数代码
//
}
protected:
///
///清理所有正在使用的资源
///
~Form1()
{
if(components)
{
deletecomponents;
}
}
private:
System:
:
Windows:
:
Forms:
:
Label^label1;
protected:
private:
System:
:
Windows:
:
Forms:
:
TextBox^textBox1;
private:
System:
:
Windows:
:
Forms:
:
ListBox^listBox1;
private:
System:
:
Windows:
:
Forms:
:
Button^button1;
private:
System:
:
Windows:
:
Forms:
:
Label^label3;
private:
System:
:
Windows:
:
Forms:
:
Label^label4;
private:
System:
:
Windows:
:
Forms:
:
OpenFileDialog^openFileDialog1;
private:
System:
:
Windows:
:
Forms:
:
RichTextBox^richTextBox1;
private:
System:
:
Windows:
:
Forms:
:
Button^button3;
private:
System:
:
Windows:
:
Forms:
:
Label^label2;
private:
System:
:
Windows:
:
Forms:
:
Label^label5;
private:
System:
:
Windows:
:
Forms:
:
Button^button4;
private:
System:
:
Windows:
:
Forms:
:
Button^button6;
private:
System:
:
Windows:
:
Forms:
:
Button^button2;
private:
///
///必需的设计器变量
///
System:
:
ComponentModel:
:
Container^components;
#pragmaregionWindowsFormDesignergeneratedcode
///
///设计器支持所需的方法不要
///使用代码编辑器修改此方法的内容
///
voidInitializeComponent(void)
{
this->label1=(gcnewSystem:
:
Windows:
:
Forms:
:
Label());
this->textBox1=(gcnewSystem:
:
Windows:
:
Forms:
:
TextBox());
this->listBox1=(gcnewSystem:
:
Windows:
:
Forms:
:
ListBox());
this->button1=(gcnewSystem:
:
Windows:
:
Forms:
:
Button());
this->label3=(gcnewSystem:
:
Windows:
:
Forms:
:
Label());
this->label4=(gcnewSystem:
:
Windows:
:
Forms:
:
Label());
this->openFileDialog1=(gcnewSystem:
:
Windows:
:
Forms:
:
OpenFileDialog());
this->richTextBox1=(gcnewSystem:
:
Windows:
:
Forms:
:
RichTextBox());
this->button3=(gcnewSystem:
:
Windows:
:
Forms:
:
Button());
this->label2=(gcnewSystem:
:
Windows:
:
Forms:
:
Label());
this->label5=(gcnewSystem:
:
Windows:
:
Forms:
:
Label());
this->button4=(gcnewSystem:
:
Windows:
:
Forms:
:
Button());
this->button6=(gcnewSystem:
:
Windows:
:
Forms:
:
Button());
this->button2=(gcnewSystem:
:
Windows:
:
Forms:
:
Button());
this->SuspendLayout();
//
//label1
//
this->label1->AutoSize=true;
this->label1->Location=System:
:
Drawing:
:
Point(51,32);
this->label1->Name=L"label1";
this->label1->Size=System:
:
Drawing:
:
Size(65,12);
this->label1->TabIndex=0;
this->label1->Text=L"请输入字符";
//
//textBox1
//
this->textBox1->Location=System:
:
Drawing:
:
Point(53,49);
this->textBox1->Name=L"textBox1";
this->textBox1->Size=System:
:
Drawing:
:
Size(100,21);
this->textBox1->TabIndex=1;
this->textBox1->KeyDown+=gcnewSystem:
:
Windows:
:
Forms:
:
KeyEventHandler(this,&Form1:
:
textBox1_KeyDown);
//
//listBox1
//
this->listBox1->FormattingEnabled=true;
this->listBox1->ItemHeight=12;
this->listBox1->Location=System:
:
Drawing:
:
Point(315,55);
this->listBox1->Name=L"listBox1";
this->listBox1->Size=System:
:
Drawing:
:
Size(120,184);
this->listBox1->TabIndex=2;
//
//button1
//
this->button1->Location=System:
:
Drawing:
:
Point(67,132);
this->button1->Name=L"button1";
this->button1->Size=System:
:
Drawing:
:
Size(75,23);
this->button1->TabIndex=4;
this->button1->Text=L"发声";
this->button1->UseVisualStyleBackColor=true;
this->button1->MouseClick+=gcnewSystem:
:
Windows:
:
Forms:
:
MouseEventHandler(this,&Form1:
:
button1_MouseClick);
//
//label3
//
this->label3->AutoSize=true;
this->label3->Location=System:
:
Drawing:
:
Point(53,95);
this->label3->Name=L"label3";
this->label3->Size=System:
:
Drawing:
:
Size(89,12);
this->label3->TabIndex=6;
this->label3->Text=L"输入的字符是:
";
//
//label4
//
this->label4->AutoSize=true;
this->label4->Location=System:
:
Drawing:
:
Point(138,95);
this->label4->Name=L"label4";
this->label4->Size=System:
:
Drawing:
:
Size(0,12);
this->label4->TabIndex=7;
//
//openFileDialog1
//
this->openFileDialog1->FileName=L"openFileDialog1";
//
//richTextBox1
//
this->richTextBox1->Location=System:
:
Drawing:
:
Point(12,256);
this->richTextBox1->Name=L"richTextBox1";
this->richTextBox1->Size=System:
:
Drawing:
:
Size(213,132);
this->richTextBox1->TabIndex=8;
this->richTextBox1->Text=L"";
//
//button3
//
this->button3->Location=System:
:
Drawing:
:
Point(315,256);
this->button3->Name=L"button3";
this->button3->Size=System:
:
Drawing:
:
Size(74,25);
this->button3->TabIndex=9;
this->button3->Text=L"打开文件";
this->button3->UseVisualStyleBackColor=true;
this->button3->Click+=gcnewSystem:
:
EventHandler(this,&Form1:
:
button3_Click);
//
//label2
//
this->label2->AutoSize=true;
this->label2->Location=System:
:
Drawing:
:
Point(313,32);
this->label2->Name=L"label2";
this->label2->Size=System:
:
Drawing:
:
Size(29,12);
this->label2->TabIndex=11;
this->label2->Text=L"编码";
//
//label5
//
this->label5->AutoSize=true;
this->label5->Location=System:
:
Drawing:
:
Point(55,238);
this->label5->Name=L"label5";
this->label5->Size=System:
:
Drawing:
:
Size(0,12);
this->label5->TabIndex=12;
//
//button4
//
this->button4->Location=System:
:
Drawing:
:
Point(315,312);
this->button4->Name=L"button4";
this->button4->Size=System:
:
Drawing:
:
Size(75,23);
this->button4->TabIndex=13;
this->button4->Text=L"编码";
this->button4->UseVisualStyleBackColor=true;
this->button4->Click+=gcnewSystem:
:
EventHandler(this,&Form1:
:
button4_Click);
//
//button6
//
this->button6->Location=System:
:
Drawing:
:
Point(315,364);
this->button6->Name=L"button6";
this->button6->Size=System:
:
Drawing:
:
Size(75,23);
this->button6->TabIndex=15;
this->button6->Text=L"发声";
this->button6->UseVisualStyleBackColor=true;
this->button6->Click+=gcnewSystem:
:
EventHandler(this,&Form1:
:
button6_Click);
//
//button2
//
this->button2->Location=System:
:
Drawing:
:
Point(453,55);
this->button2->Name=L"button2";
this->button2->Size=System:
:
Drawing:
:
Size(75,23);
this->button2->TabIndex=16;
this->button2->Text=L"清空";
this->button2->UseVisualStyleBackColor=true;
this->button2->Click+=gcnewSystem:
:
EventHandler(this,&Form1:
:
button2_Click);
//