好吧,我正在Microsoft Visual Studio C++ 2010中製作簡單的便籤應用程序(Winodws Forms)in C++。 我試圖製作一個可拖動的無邊框窗體。 我現在的密碼是:C++ Draggable無國界形式
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
this->dragging = false;
}
private: System::Void Form1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
this->dragging = true;
this->offset = Point(e->X, e->Y);
}
private: System::Void Form1_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if (this->dragging)
{
Point currentScreenPos = PointToScreen(e->Location);
Location = Point(currentScreenPos.X - this->offset.X, currentScreenPos.Y - this->offset.Y);
}
}
private: System::Void Form1_MouseUp(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
this->dragging = false;
}
這對我不起作用。誰能幫忙?
展開「不起作用」。 –
您在MouseMove事件中未使用「e」。 –