如何在我的表单中为图片框使用 WndProc 函数?我尝试使用此代码,但它不起作用并且没有任何消息发送给我的公众:virtual void WndProc(Message% m)
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace MyProject {
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void) {
InitializeComponent();
//TODO: Add the constructor code here
}
protected:
~Form1() {
if (components)
delete components;
}
private:
System::Windows::Forms::PictureBox^ pictureBox1;
System::ComponentModel::Container ^components;
void InitializeComponent(void) {
this->pictureBox1 = gcnew System::Windows::Forms::PictureBox();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(
this->pictureBox1))->BeginInit();
this->SuspendLayout();
//
// pictureBox1
//
this->pictureBox1->Location = System::Drawing::Point(41, 27);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(206, 203);
this->pictureBox1->TabIndex = 0;
this->pictureBox1->TabStop = false;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 265);
this->Controls->Add(this->pictureBox1);
this->Name = L"Form1";
this->Text = L"Form1";
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(
this->pictureBox1))->EndInit();
this->ResumeLayout(false);
}
};
ref class pictureBox1 : PictureBox {
public:
virtual void WndProc( Message% m ) override {
__super::WndProc(m);
}
};
}//close NameSpace