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);
}
謝謝。