主要设计代码下:
首先是界面的设计代码:
(cli::safe_cast
this->SuspendLayout(); //
// toolStrip1 //
this->toolStrip1->Dock = System::Windows::Forms::DockStyle::Left; this->toolStrip1->Items->AddRange(gcnew cli::array< void InitializeComponent(void) {
System::ComponentModel::ComponentResourceManager^ resources = (gcnew this->colorDialog1 = (gcnew System::Windows::Forms::ColorDialog()); this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripButton()); this->toolStripButton2 = (gcnew System::Windows::Forms::ToolStripButton()); this->toolStripButton3 = (gcnew System::Windows::Forms::ToolStripButton()); this->toolStripSeparator1 = (gcnew
this->toolStripLabel1 = (gcnew System::Windows::Forms::ToolStripLabel()); this->toolStripButton5 = (gcnew System::Windows::Forms::ToolStripButton()); this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox()); this->toolStrip1->SuspendLayout();
System::ComponentModel::ComponentResourceManager(Form1::typeid));
System::Windows::Forms::ToolStripSeparator());
eginInit();
System::Windows::Forms::ToolStripItem^ >(6) {
});
this->toolStripButton1,
this->toolStripButton2, this->toolStripButton3,
this->toolStripSeparator1, this->toolStripLabel1, this->toolStripButton5
this->toolStrip1->Location = System::Drawing::Point(0, 0); this->toolStrip1->Name = L\; this->toolStrip1->RenderMode =
this->toolStrip1->Size = System::Drawing::Size(41, 312); this->toolStrip1->TabIndex = 0;
this->toolStrip1->Text = L\; //
// toolStripButton1 //
this->toolStripButton1->DisplayStyle = this->toolStripButton1->Image =
System::Windows::Forms::ToolStripRenderMode::Professional;
System::Windows::Forms::ToolStripItemDisplayStyle::Image;
(cli::safe_cast
this->toolStripButton1->ImageTransparentColor = this->toolStripButton1->Name = L\;
this->toolStripButton1->Size = System::Drawing::Size(38, 20); this->toolStripButton1->Text = L\;
this->toolStripButton1->Click += gcnew System::EventHandler(this, //
// toolStripButton2 //
this->toolStripButton2->AutoToolTip = false; this->toolStripButton2->DisplayStyle = this->toolStripButton2->Image =
System::Drawing::Color::Magenta;
&Form1::toolStripButton1_Click);
System::Windows::Forms::ToolStripItemDisplayStyle::Image;
(cli::safe_cast
this->toolStripButton2->ImageTransparentColor = this->toolStripButton2->Name = L\;
this->toolStripButton2->Size = System::Drawing::Size(38, 20); this->toolStripButton2->Text = L\;
this->toolStripButton2->Click += gcnew System::EventHandler(this, //
// toolStripButton3
System::Drawing::Color::Magenta;
&Form1::toolStripButton2_Click);
//
this->toolStripButton3->DisplayStyle = this->toolStripButton3->Image =
System::Windows::Forms::ToolStripItemDisplayStyle::Image;
(cli::safe_cast
this->toolStripButton3->ImageTransparentColor = this->toolStripButton3->Name = L\;
this->toolStripButton3->Size = System::Drawing::Size(38, 20); this->toolStripButton3->Text = L\;
this->toolStripButton3->Click += gcnew System::EventHandler(this, //
// toolStripSeparator1 //
this->toolStripSeparator1->Name = L\; this->toolStripSeparator1->Size = System::Drawing::Size(38, 6); //
// toolStripLabel1 //
this->toolStripLabel1->Name = L\;
this->toolStripLabel1->Size = System::Drawing::Size(38, 17); this->toolStripLabel1->Text = L\; //
// toolStripButton5 //
this->toolStripButton5->DisplayStyle = this->toolStripButton5->Image =
System::Drawing::Color::Magenta;
&Form1::toolStripButton3_Click);
System::Windows::Forms::ToolStripItemDisplayStyle::Image;
(cli::safe_cast
this->toolStripButton5->ImageTransparentColor = this->toolStripButton5->Name = L\;
this->toolStripButton5->Size = System::Drawing::Size(38, 20); this->toolStripButton5->Text = L\;
this->toolStripButton5->Click += gcnew System::EventHandler(this, //
// pictureBox1 //
this->pictureBox1->Location = System::Drawing::Point(44, 0); this->pictureBox1->Name = L\;
System::Drawing::Color::Magenta;
&Form1::toolStripButton5_Click);
this->pictureBox1->Size = System::Drawing::Size(463, 312); this->pictureBox1->SizeMode = this->pictureBox1->TabIndex = 1; this->pictureBox1->TabStop = false; this->pictureBox1->Paint += gcnew this->pictureBox1->MouseDown += gcnew this->pictureBox1->MouseMove += gcnew this->pictureBox1->MouseUp += gcnew // // Form1 //
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->BackColor = System::Drawing::SystemColors::Window; this->ClientSize = System::Drawing::Size(506, 312); this->Controls->Add(this->pictureBox1); this->Controls->Add(this->toolStrip1); this->Name = L\; this->Text = L\;
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, this->toolStrip1->ResumeLayout(false); this->toolStrip1->PerformLayout();
System::Windows::Forms::PictureBoxSizeMode::AutoSize;
System::Windows::Forms::PaintEventHandler(this, &Form1::pictureBox1_Paint); System::Windows::Forms::MouseEventHandler(this, &Form1::pictureBox1_MouseDown); System::Windows::Forms::MouseEventHandler(this, &Form1::pictureBox1_MouseMove); System::Windows::Forms::MouseEventHandler(this, &Form1::pictureBox1_MouseUp);
&Form1::Form1_Paint);
(cli::safe_cast
}
this->ResumeLayout(false); this->PerformLayout();
ndInit();
#pragma endregion
private: System::Void Form1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
//pencolor = Color::Black;
// bmp = gcnew Bitmap(pictureBox1->Width, pictureBox1->Height); //orginalImg = bmp;
相关推荐: