Blame | Last modification | View Log | RSS feed
#pragma onceusing namespace System;using namespace System::ComponentModel;using namespace System::Collections;using namespace System::Windows::Forms;using namespace System::Data;using namespace System::Drawing;namespace PluginManager {/// <summary>/// Summary for MessageBoxDetails////// 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./// </summary>public ref class MessageBoxDetails : public System::Windows::Forms::Form{public:static System::Windows::Forms::DialogResult Show(System::Windows::Forms::Form ^parent, String ^title, String ^desc, String ^details) { return MessageBoxDetails::Show(parent, title, desc, details, true); }static System::Windows::Forms::DialogResult Show(System::Windows::Forms::Form ^parent, String ^title, String ^desc, String ^details, bool cancel) { return MessageBoxDetails::Show(parent, title, desc, details, cancel, 400); }static System::Windows::Forms::DialogResult Show(System::Windows::Forms::Form ^parent, String ^title, String ^desc, String ^details, bool cancel, int initialwidth){MessageBoxDetails ^form = gcnew MessageBoxDetails(title, desc, details, cancel);form->Width = initialwidth;System::Windows::Forms::DialogResult res = form->ShowDialog(parent);delete form;return res;}MessageBoxDetails(String ^title, String ^desc, String ^details, bool cancel){InitializeComponent();m_sDetails = "Details";this->Text = title;this->richTextBox1->Text = desc;this->richTextBox2->Text = details;this->richTextBox1->SelectionAlignment = HorizontalAlignment::Center;this->button2->Focus();if ( !cancel )NoCancel();CloseDetails();}void SetCancelText(String ^text) { this->button3->Text = text; }void SetOkText(String ^text) { this->button2->Text = text; }void SetDetailsText(String ^text) { m_sDetails = text; }void NoCancel() { this->button3->Hide(); }void OpenDetails(){m_bDetails = true;this->button1->Text = m_sDetails + " <<<";this->Height += m_iHeight;this->splitContainer1->Panel2Collapsed = false;}void CloseDetails(){m_bDetails = false;this->button1->Text = m_sDetails + " >>>";int diff = this->Height - this->splitContainer1->Height;m_iHeight = this->splitContainer1->Panel2->Height + this->splitContainer1->SplitterWidth;int h = diff + (this->splitContainer1->Height - m_iHeight);this->splitContainer1->Panel2Collapsed = true;this->Height = h;}protected:/// <summary>/// Clean up any resources being used./// </summary>~MessageBoxDetails(){if (components){delete components;}}String ^m_sDetails;bool m_bDetails;int m_iHeight;private: System::Windows::Forms::SplitContainer^ splitContainer1;protected:private: System::Windows::Forms::Panel^ panel1;private: System::Windows::Forms::Panel^ panel2;private: System::Windows::Forms::Button^ button1;private: System::Windows::Forms::RichTextBox^ richTextBox1;private: System::Windows::Forms::Button^ button3;private: System::Windows::Forms::Button^ button2;private: System::Windows::Forms::RichTextBox^ richTextBox2;private:/// <summary>/// Required designer variable./// </summary>System::ComponentModel::Container ^components;#pragma region Windows Form Designer generated code/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>void InitializeComponent(void){this->splitContainer1 = (gcnew System::Windows::Forms::SplitContainer());this->panel1 = (gcnew System::Windows::Forms::Panel());this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox());this->panel2 = (gcnew System::Windows::Forms::Panel());this->button3 = (gcnew System::Windows::Forms::Button());this->button2 = (gcnew System::Windows::Forms::Button());this->button1 = (gcnew System::Windows::Forms::Button());this->richTextBox2 = (gcnew System::Windows::Forms::RichTextBox());this->splitContainer1->Panel1->SuspendLayout();this->splitContainer1->Panel2->SuspendLayout();this->splitContainer1->SuspendLayout();this->panel1->SuspendLayout();this->panel2->SuspendLayout();this->SuspendLayout();//// splitContainer1//this->splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;this->splitContainer1->Location = System::Drawing::Point(0, 0);this->splitContainer1->Name = L"splitContainer1";this->splitContainer1->Orientation = System::Windows::Forms::Orientation::Horizontal;//// splitContainer1.Panel1//this->splitContainer1->Panel1->Controls->Add(this->panel1);this->splitContainer1->Panel1->Controls->Add(this->panel2);//// splitContainer1.Panel2//this->splitContainer1->Panel2->Controls->Add(this->richTextBox2);this->splitContainer1->Panel2->Padding = System::Windows::Forms::Padding(5);this->splitContainer1->Size = System::Drawing::Size(413, 268);this->splitContainer1->SplitterDistance = 90;this->splitContainer1->TabIndex = 0;//// panel1//this->panel1->Controls->Add(this->richTextBox1);this->panel1->Dock = System::Windows::Forms::DockStyle::Fill;this->panel1->Location = System::Drawing::Point(0, 0);this->panel1->Name = L"panel1";this->panel1->Padding = System::Windows::Forms::Padding(5);this->panel1->Size = System::Drawing::Size(413, 57);this->panel1->TabIndex = 0;//// richTextBox1//this->richTextBox1->BorderStyle = System::Windows::Forms::BorderStyle::None;this->richTextBox1->Dock = System::Windows::Forms::DockStyle::Fill;this->richTextBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,static_cast<System::Byte>(0)));this->richTextBox1->Location = System::Drawing::Point(5, 5);this->richTextBox1->Name = L"richTextBox1";this->richTextBox1->ReadOnly = true;this->richTextBox1->ScrollBars = System::Windows::Forms::RichTextBoxScrollBars::ForcedVertical;this->richTextBox1->Size = System::Drawing::Size(403, 47);this->richTextBox1->TabIndex = 0;this->richTextBox1->Text = L"";//// panel2//this->panel2->Controls->Add(this->button3);this->panel2->Controls->Add(this->button2);this->panel2->Controls->Add(this->button1);this->panel2->Dock = System::Windows::Forms::DockStyle::Bottom;this->panel2->Location = System::Drawing::Point(0, 57);this->panel2->Name = L"panel2";this->panel2->Padding = System::Windows::Forms::Padding(5);this->panel2->Size = System::Drawing::Size(413, 33);this->panel2->TabIndex = 1;//// button3//this->button3->DialogResult = System::Windows::Forms::DialogResult::Cancel;this->button3->Dock = System::Windows::Forms::DockStyle::Right;this->button3->Location = System::Drawing::Point(255, 5);this->button3->Name = L"button3";this->button3->Size = System::Drawing::Size(78, 23);this->button3->TabIndex = 2;this->button3->Text = L"Cancel";this->button3->UseVisualStyleBackColor = true;//// button2//this->button2->DialogResult = System::Windows::Forms::DialogResult::OK;this->button2->Dock = System::Windows::Forms::DockStyle::Right;this->button2->Location = System::Drawing::Point(333, 5);this->button2->Name = L"button2";this->button2->Size = System::Drawing::Size(75, 23);this->button2->TabIndex = 1;this->button2->Text = L"Ok";this->button2->UseVisualStyleBackColor = true;//// button1//this->button1->Dock = System::Windows::Forms::DockStyle::Left;this->button1->Location = System::Drawing::Point(5, 5);this->button1->Name = L"button1";this->button1->Size = System::Drawing::Size(75, 23);this->button1->TabIndex = 0;this->button1->Text = L"button1";this->button1->UseVisualStyleBackColor = true;this->button1->Click += gcnew System::EventHandler(this, &MessageBoxDetails::button1_Click);//// richTextBox2//this->richTextBox2->BorderStyle = System::Windows::Forms::BorderStyle::None;this->richTextBox2->Dock = System::Windows::Forms::DockStyle::Fill;this->richTextBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,static_cast<System::Byte>(0)));this->richTextBox2->Location = System::Drawing::Point(5, 5);this->richTextBox2->Name = L"richTextBox2";this->richTextBox2->ReadOnly = true;this->richTextBox2->ScrollBars = System::Windows::Forms::RichTextBoxScrollBars::ForcedVertical;this->richTextBox2->Size = System::Drawing::Size(403, 164);this->richTextBox2->TabIndex = 1;this->richTextBox2->Text = L"";//// MessageBoxDetails//this->AcceptButton = this->button2;this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;this->CancelButton = this->button3;this->ClientSize = System::Drawing::Size(413, 268);this->ControlBox = false;this->Controls->Add(this->splitContainer1);this->Name = L"MessageBoxDetails";this->ShowInTaskbar = false;this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;this->Text = L"MessageBoxDetails";this->splitContainer1->Panel1->ResumeLayout(false);this->splitContainer1->Panel2->ResumeLayout(false);this->splitContainer1->ResumeLayout(false);this->panel1->ResumeLayout(false);this->panel2->ResumeLayout(false);this->ResumeLayout(false);}#pragma endregionprivate: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {if ( m_bDetails )CloseDetails();elseOpenDetails();}};}