1
我正在开发一个Windows窗体程序,并且很难找到如何在C++中执行此操作。 MSDN有这个页面,http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image,但与VB相比C++文档缺乏。在mouseover上更改图片框,并在mouseleave上重置
这是我到目前为止。这种方法应该避免常见的闪烁问题,但我不知道该从哪里开始,因为我需要它在鼠标离开后回到原始图像。
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);
}
谢谢。