第二种就是 鼠标移动,窗口就跟着移动..在拖动时会有写尾巴..
wxPoint m_delta ;
在构造里设置
设置窗口风格
SetWindowStyleFlag(wxFRAME_NO_TASKBAR | wxNO_BORDER);
void MyFrame::OnMouseMove(wxMouseEvent& event)
{
if (event.Dragging() && event.LeftIsDown())
{
wxPoint pt = ClientToScreen(event.GetPosition());
int x = pt.x - m_delta.x;
int y = pt.y - m_delta.y;
Move(x, y);
}
}
void MyFrame ::OnMouseLeftDown(wxMouseEvent& event)
{
CaptureMouse();
wxPoint pt = ClientToScreen(event.GetPosition());
wxPoint origin = GetPosition();
int dx = pt.x - origin.x;
int dy = pt.y - origin.y;
m_delta = wxPoint(dx, dy);
}
void MyFrame::OnMouseLeftUp(wxMouseEvent& WXUNUSED(event))
{
if (HasCapture())
{
ReleaseMouse();
}
}