#pragma once
using namespace System::IO;
namespace 实验6 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Form1 摘要
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: 在此处添加构造函数代码
//
}
protected:
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
protected:
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::TextBox^ textBox3;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::RichTextBox^ richTextBox1;
private: System::Windows::Forms::ColorDialog^ colorDialog1;
private: System::Windows::Forms::FolderBrowserDialog^ folderBrowserDialog1;
private: System::Windows::Forms::FontDialog^ fontDialog1;
private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;
private: System::Windows::Forms::SaveFileDialog^ saveFileDialog1;
private: System::Windows::Forms::MenuStrip^ menuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^ 文件ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 新建ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 保存ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 打开ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 另存为ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 退出ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 编辑ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 撤销ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 恢复ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 复制ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 粘贴ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 剪切ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 查找ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 替换ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 格式ToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ 字体ToolStripMenuItem;
private: System::Windows::Forms::RichTextBox^ richTextBox2;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::RichTextBox^ richTextBox3;
private: System::Windows::Forms::Label^ label7;
private: System::Windows::Forms::RichTextBox^ richTextBox4;
private: System::Windows::Forms::ToolStripMenuItem^ 颜色ToolStripMenuItem;
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
void InitializeComponent(void)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox());
this->colorDialog1 = (gcnew System::Windows::Forms::ColorDialog());
this->folderBrowserDialog1 = (gcnew System::Windows::Forms::FolderBrowserDialog());
this->fontDialog1 = (gcnew System::Windows::Forms::FontDialog());
this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
this->saveFileDialog1 = (gcnew System::Windows::Forms::SaveFileDialog());
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->文件ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->新建ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->保存ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->打开ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->另存为ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->退出ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->编辑ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->撤销ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->恢复ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->复制ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->粘贴ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->剪切ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->查找ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->替换ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->格式ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->字体ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->richTextBox2 = (gcnew System::Windows::Forms::RichTextBox());
this->label6 = (gcnew System::Windows::Forms::Label());
this->richTextBox3 = (gcnew System::Windows::Forms::RichTextBox());
this->label7 = (gcnew System::Windows::Forms::Label());
this->richTextBox4 = (gcnew System::Windows::Forms::RichTextBox());
this->颜色ToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->groupBox1->SuspendLayout();
this->menuStrip1->SuspendLayout();
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->label1->Location = System::Drawing::Point(14, 32);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(60, 19);
this->label1->TabIndex = 0;
this->label1->Text = L"A的值";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->label2->Location = System::Drawing::Point(14, 100);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(60, 19);
this->label2->TabIndex = 1;
this->label2->Text = L"B的值";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->label3->Location = System::Drawing::Point(14, 167);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(60, 19);
this->label3->TabIndex = 2;
this->label3->Text = L"C的值";
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(95, 29);
this->textBox1->Margin = System::Windows::Forms::Padding(3, 4, 3, 4);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(112, 28);
this->textBox1->TabIndex = 3;
this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(95, 100);
this->textBox2->Margin = System::Windows::Forms::Padding(3, 4, 3, 4);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(112, 28);
this->textBox2->TabIndex = 4;
this->textBox2->TextChanged += gcnew System::EventHandler(this, &Form1::textBox2_TextChanged);
//
// textBox3
//
this->textBox3->Location = System::Drawing::Point(95, 167);
this->textBox3->Margin = System::Windows::Forms::Padding(3, 4, 3, 4);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System::Drawing::Size(112, 28);
this->textBox3->TabIndex = 5;
this->textBox3->TextChanged += gcnew System::EventHandler(this, &Form1::textBox3_TextChanged);
//
// button1
//
this->button1->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->button1->Location = System::Drawing::Point(25, 216);
this->button1->Margin = System::Windows::Forms::Padding(3, 4, 3, 4);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(109, 35);
this->button1->TabIndex = 7;
this->button1->Text = L"计算";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// groupBox1
//
this->groupBox1->BackColor = System::Drawing::SystemColors::ButtonFace;
this->groupBox1->Controls->Add(this->richTextBox1);
this->groupBox1->Controls->Add(this->textBox1);
this->groupBox1->Controls->Add(this->button1);
this->groupBox1->Controls->Add(this->label1);
this->groupBox1->Controls->Add(this->label2);
this->groupBox1->Controls->Add(this->textBox3);
this->groupBox1->Controls->Add(this->label3);
this->groupBox1->Controls->Add(this->textBox2);
this->groupBox1->Location = System::Drawing::Point(611, 82);
this->groupBox1->Margin = System::Windows::Forms::Padding(3, 4, 3, 4);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Padding = System::Windows::Forms::Padding(3, 4, 3, 4);
this->groupBox1->Size = System::Drawing::Size(302, 548);
this->groupBox1->TabIndex = 8;
this->groupBox1->TabStop = false;
//
// richTextBox1
//
this->richTextBox1->BackColor = System::Drawing::SystemColors::Info;
this->richTextBox1->Location = System::Drawing::Point(18, 272);
this->richTextBox1->Margin = System::Windows::Forms::Padding(3, 4, 3, 4);
this->richTextBox1->Name = L"richTextBox1";
this->richTextBox1->Size = System::Drawing::Size(245, 268);
this->richTextBox1->TabIndex = 8;
this->richTextBox1->Text = L"";
this->richTextBox1->TextChanged += gcnew System::EventHandler(this, &Form1::richTextBox1_TextChanged);
//
// openFileDialog1
//
this->openFileDialog1->FileName = L"openFileDialog1";
//
// menuStrip1
//
this->menuStrip1->BackColor = System::Drawing::SystemColors::Highlight;
this->menuStrip1->Font = (gcnew System::Drawing::Font(L"宋体", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {this->文件ToolStripMenuItem,
this->编辑ToolStripMenuItem, this->格式ToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Padding = System::Windows::Forms::Padding(7, 2, 0, 2);
this->menuStrip1->Size = System::Drawing::Size(1146, 28);
this->menuStrip1->TabIndex = 9;
this->menuStrip1->Text = L"menuStrip1";
//
// 文件ToolStripMenuItem
//
this->文件ToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(5) {this->新建ToolStripMenuItem,
this->保存ToolStripMenuItem, this->打开ToolStripMenuItem, this->另存为ToolStripMenuItem, this->退出ToolStripMenuItem});
this->文件ToolStripMenuItem->Name = L"文件ToolStripMenuItem";
this->文件ToolStripMenuItem->Size = System::Drawing::Size(61, 24);
this->文件ToolStripMenuItem->Text = L"文件";
//
// 新建ToolStripMenuItem
//
this->新建ToolStripMenuItem->Name = L"新建ToolStripMenuItem";
this->新建ToolStripMenuItem->Size = System::Drawing::Size(138, 24);
this->新建ToolStripMenuItem->Text = L"新建";
//
// 保存ToolStripMenuItem
//
this->保存ToolStripMenuItem->Name = L"保存ToolStripMenuItem";
this->保存ToolStripMenuItem->Size = System::Drawing::Size(138, 24);
this->保存ToolStripMenuItem->Text = L"保存";
this->保存ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::保存ToolStripMenuItem_Click);
//
// 打开ToolStripMenuItem
//
this->打开ToolStripMenuItem->Name = L"打开ToolStripMenuItem";
this->打开ToolStripMenuItem->Size = System::Drawing::Size(138, 24);
this->打开ToolStripMenuItem->Text = L"打开";
this->打开ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::打开ToolStripMenuItem_Click);
//
// 另存为ToolStripMenuItem
//
this->另存为ToolStripMenuItem->Name = L"另存为ToolStripMenuItem";
this->另存为ToolStripMenuItem->Size = System::Drawing::Size(138, 24);
this->另存为ToolStripMenuItem->Text = L"另存为";
this->另存为ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::另存为ToolStripMenuItem_Click);
//
// 退出ToolStripMenuItem
//
this->退出ToolStripMenuItem->Name = L"退出ToolStripMenuItem";
this->退出ToolStripMenuItem->Size = System::Drawing::Size(138, 24);
this->退出ToolStripMenuItem->Text = L"退出";
this->退出ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::退出ToolStripMenuItem_Click);
//
// 编辑ToolStripMenuItem
//
this->编辑ToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(7) {this->撤销ToolStripMenuItem,
this->恢复ToolStripMenuItem, this->复制ToolStripMenuItem, this->粘贴ToolStripMenuItem, this->剪切ToolStripMenuItem, this->查找ToolStripMenuItem,
this->替换ToolStripMenuItem});
this->编辑ToolStripMenuItem->Name = L"编辑ToolStripMenuItem";
this->编辑ToolStripMenuItem->Size = System::Drawing::Size(61, 24);
this->编辑ToolStripMenuItem->Text = L"编辑";
//
// 撤销ToolStripMenuItem
//
this->撤销ToolStripMenuItem->Name = L"撤销ToolStripMenuItem";
this->撤销ToolStripMenuItem->Size = System::Drawing::Size(118, 24);
this->撤销ToolStripMenuItem->Text = L"撤销";
this->撤销ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::撤销ToolStripMenuItem_Click);
//
// 恢复ToolStripMenuItem
//
this->恢复ToolStripMenuItem->Name = L"恢复ToolStripMenuItem";
this->恢复ToolStripMenuItem->Size = System::Drawing::Size(118, 24);
this->恢复ToolStripMenuItem->Text = L"恢复";
//
// 复制ToolStripMenuItem
//
this->复制ToolStripMenuItem->Name = L"复制ToolStripMenuItem";
this->复制ToolStripMenuItem->Size = System::Drawing::Size(118, 24);
this->复制ToolStripMenuItem->Text = L"复制";
this->复制ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::复制ToolStripMenuItem_Click);
//
// 粘贴ToolStripMenuItem
//
this->粘贴ToolStripMenuItem->Name = L"粘贴ToolStripMenuItem";
this->粘贴ToolStripMenuItem->Size = System::Drawing::Size(118, 24);
this->粘贴ToolStripMenuItem->Text = L"粘贴";
this->粘贴ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::粘贴ToolStripMenuItem_Click);
//
// 剪切ToolStripMenuItem
//
this->剪切ToolStripMenuItem->Name = L"剪切ToolStripMenuItem";
this->剪切ToolStripMenuItem->Size = System::Drawing::Size(118, 24);
this->剪切ToolStripMenuItem->Text = L"剪切";
this->剪切ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::剪切ToolStripMenuItem_Click);
//
// 查找ToolStripMenuItem
//
this->查找ToolStripMenuItem->Name = L"查找ToolStripMenuItem";
this->查找ToolStripMenuItem->Size = System::Drawing::Size(118, 24);
this->查找ToolStripMenuItem->Text = L"查找";
this->查找ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::查找ToolStripMenuItem_Click);
//
// 替换ToolStripMenuItem
//
this->替换ToolStripMenuItem->Name = L"替换ToolStripMenuItem";
this->替换ToolStripMenuItem->Size = System::Drawing::Size(118, 24);
this->替换ToolStripMenuItem->Text = L"替换";
this->替换ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::替换ToolStripMenuItem_Click);
//
// 格式ToolStripMenuItem
//
this->格式ToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->字体ToolStripMenuItem,
this->颜色ToolStripMenuItem});
this->格式ToolStripMenuItem->Name = L"格式ToolStripMenuItem";
this->格式ToolStripMenuItem->Size = System::Drawing::Size(61, 24);
this->格式ToolStripMenuItem->Text = L"格式";
//
// 字体ToolStripMenuItem
//
this->字体ToolStripMenuItem->Name = L"字体ToolStripMenuItem";
this->字体ToolStripMenuItem->Size = System::Drawing::Size(152, 24);
this->字体ToolStripMenuItem->Text = L"字体";
this->字体ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::字体ToolStripMenuItem_Click);
//
// richTextBox2
//
this->richTextBox2->BackColor = System::Drawing::SystemColors::ScrollBar;
this->richTextBox2->Location = System::Drawing::Point(12, 52);
this->richTextBox2->Name = L"richTextBox2";
this->richTextBox2->Size = System::Drawing::Size(550, 318);
this->richTextBox2->TabIndex = 10;
this->richTextBox2->Text = L"";
//
// label6
//
this->label6->AutoSize = true;
this->label6->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->label6->Location = System::Drawing::Point(34, 402);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(149, 19);
this->label6->TabIndex = 16;
this->label6->Text = L"查找以下内容:";
//
// richTextBox3
//
this->richTextBox3->Location = System::Drawing::Point(38, 436);
this->richTextBox3->Name = L"richTextBox3";
this->richTextBox3->Size = System::Drawing::Size(513, 71);
this->richTextBox3->TabIndex = 17;
this->richTextBox3->Text = L"";
//
// label7
//
this->label7->AutoSize = true;
this->label7->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->label7->Location = System::Drawing::Point(34, 524);
this->label7->Name = L"label7";
this->label7->Size = System::Drawing::Size(89, 19);
this->label7->TabIndex = 18;
this->label7->Text = L"替换为:";
//
// richTextBox4
//
this->richTextBox4->Location = System::Drawing::Point(38, 559);
this->richTextBox4->Name = L"richTextBox4";
this->richTextBox4->Size = System::Drawing::Size(513, 71);
this->richTextBox4->TabIndex = 19;
this->richTextBox4->Text = L"";
//
// 颜色ToolStripMenuItem
//
this->颜色ToolStripMenuItem->Name = L"颜色ToolStripMenuItem";
this->颜色ToolStripMenuItem->Size = System::Drawing::Size(152, 24);
this->颜色ToolStripMenuItem->Text = L"颜色";
this->颜色ToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::颜色ToolStripMenuItem_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(9, 18);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::SystemColors::ButtonFace;
this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Center;
this->ClientSize = System::Drawing::Size(1146, 664);
this->Controls->Add(this->richTextBox4);
this->Controls->Add(this->label7);
this->Controls->Add(this->richTextBox3);
this->Controls->Add(this->label6);
this->Controls->Add(this->richTextBox2);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->menuStrip1);
this->Font = (gcnew System::Drawing::Font(L"宋体", 10.8F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->MainMenuStrip = this->menuStrip1;
this->Margin = System::Windows::Forms::Padding(3, 4, 3, 4);
this->Name = L"Form1";
this->Text = L"实验六";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
int fac(int a)
{
int s=1;
for(int i=1;i<=a;i++)
{
s*=i;
}
return s;
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
int a=System::Convert::ToInt32(textBox1->Text);
int b=System::Convert::ToInt32(textBox2->Text);
int c=System::Convert::ToInt32(textBox3->Text);
richTextBox1->Text+="A!+B!+C!=:"+System::Convert::ToString(fac(a)+fac(b)+fac(c))+"\n";
}
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
int a=System::Convert::ToInt32(textBox1->Text);
richTextBox1->Text+="A的阶乘为:"+System::Convert::ToString(fac(a))+"\n";
}
private: System::Void textBox2_TextChanged(System::Object^ sender, System::EventArgs^ e) {
int a=System::Convert::ToInt32(textBox2->Text);
richTextBox1->Text+="B的阶乘为:"+System::Convert::ToString(fac(a))+"\n";
}
private: System::Void textBox3_TextChanged(System::Object^ sender, System::EventArgs^ e) {
int a=System::Convert::ToInt32(textBox3->Text);
richTextBox1->Text+="C的阶乘为:"+System::Convert::ToString(fac(a))+"\n";
}
private: System::Void richTextBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void label5_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void 打开ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
//openFileDialog1->InitialDirectory="C:\\实验六\\笔记.txt";
openFileDialog1->Filter="文本文件(*.txt)|*.txt";
if(openFileDialog1->ShowDialog()==Windows::Forms::DialogResult::OK)
{
StreamReader^ str=gcnew StreamReader(openFileDialog1->FileName);
richTextBox2->Text=str->ReadToEnd();
str->Close();
}
}
private: System::Void 保存ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
if(saveFileDialog1->ShowDialog()==Windows::Forms::DialogResult::OK)
{
StreamWriter ^str=File::CreateText(saveFileDialog1->FileName);
str->Write(richTextBox2->Text);
str->Close();
}
}
private: System::Void 另存为ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
if(saveFileDialog1->ShowDialog()==Windows::Forms::DialogResult::OK)
{
StreamWriter ^str=File::CreateText(saveFileDialog1->FileName);
str->Write(richTextBox2->Text);
str->Close();
}
}
private: System::Void 退出ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
this->Close();
}
private: System::Void 撤销ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
richTextBox2->Undo();
}
private: System::Void 复制ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
richTextBox2->Copy();
}
private: System::Void 粘贴ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
richTextBox2->Paste();
}
private: System::Void 剪切ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
richTextBox2->Cut();
}
private: System::Void 查找ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
String^ str1 = richTextBox3->Text;
int position = richTextBox2->Text->IndexOf(str1);
int startindex=0;
int nextindex = -1;
while (nextindex != startindex)
{
richTextBox2->Select(position,str1->Length);
richTextBox2->SelectionColor = Color::Blue;
nextindex=richTextBox2->Find(str1, position + str1->Length,RichTextBoxFinds::WholeWord);
if (nextindex == -1)
{
nextindex=startindex;
}
position = nextindex;
}
}
private: System::Void label6_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void groupBox2_Enter(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void 替换ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
String^ str1 = richTextBox3->Text;
String^ str2 = richTextBox4->Text;
richTextBox2->SelectedText = str1->Replace(str1, str2);
}
private: System::Void 字体ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void 颜色ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
}
};
}
面向对象——实验6
于 2024-04-28 10:06:14 首次发布