
#pragma once
namespace My25 {
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 for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
///
/// Clean up any resources being used.
///
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ BtnOpenFont;
private: System::Windows::Forms::TextBox^ t;
private: System::Windows::Forms::FontDialog^ f;
protected:
private:
///
/// Required designer variable.
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
void InitializeComponent(void)
{
this->BtnOpenFont = (gcnew System::Windows::Forms::Button());
this->t = (gcnew System::Windows::Forms::TextBox());
this->f = (gcnew System::Windows::Forms::FontDialog());
this->SuspendLayout();
//
// BtnOpenFont
//
this->BtnOpenFont->Location = System::Drawing::Point(16, 209);
this->BtnOpenFont->Name = L"BtnOpenFont";
this->BtnOpenFont->Size = System::Drawing::Size(264, 49);
this->BtnOpenFont->TabIndex = 0;
this->BtnOpenFont->Text = L"Open Font";
this->BtnOpenFont->UseVisualStyleBackColor = true;
this->BtnOpenFont->Click += gcnew System::EventHandler(this, &Form1::BtnOpenFont_Click);
//
// t
//
this->t->Location = System::Drawing::Point(22, 12);
this->t->Multiline = true;
this->t->Name = L"t";
this->t->Size = System::Drawing::Size(258, 182);
this->t->TabIndex = 1;
this->t->Text = L"fdasfdasf";
//
// f
//
this->f->Apply += gcnew System::EventHandler(this, &Form1::f_Apply);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 266);
this->Controls->Add(this->t);
this->Controls->Add(this->BtnOpenFont);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
//FontDialog
private: System::Void BtnOpenFont_Click(System::Object^ sender, System::EventArgs^ e) {
f->ShowApply=true;
f->ShowColor=true;
f->ShowEffects=true;
if(f->ShowDialog()==System::Windows::Forms::DialogResult::Cancel)
{
t->ResetForeColor();
t->ResetFont();
}else{
t->Font::set(f->Font::get());
t->ForeColor::set(f->Color::get());
}
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void f_Apply(System::Object^ sender, System::EventArgs^ e) {
t->Font::set(f->Font::get());
t->ForeColor::set(f->Color::get());
}
};
}