我正在开发一个 Windows 窗体程序,并且很难找到如何在 C++ 中执行此操作。MSDN 有这个页面, http: //msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image,但与 VB 相比,缺少 C++ 文档。
这就是我到目前为止所拥有的。这种方法应该避免常见的闪烁问题,但我不确定从那里去哪里,因为我需要它在鼠标离开后返回到原始图像。
void InitializeComponent(void)
{
this->btnExit->BackColor = System::Drawing::Color::Transparent;
this->btnExit->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
this->btnExit->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"btnExit.Image")));
this->btnExit->Location = System::Drawing::Point(764, 4);
this->btnExit->Name = L"btnExit";
this->btnExit->Size = System::Drawing::Size(30, 20);
this->btnExit->TabIndex = 3;
this->btnExit->TabStop = false;
this->btnExit->Click += gcnew System::EventHandler(this, &mainForm::btnExit_Click);
}
#pragma endregion
private: System::Void btnExit_OnMouseEnter(System::Object^ sender, System::EventArgs^ e) {
Image^ get ();
void set (Image^ value);
}
谢谢。