m_button.SetWindowTextW(_T("逃跑"));
CBitmap bitmap;
bitmap.LoadBitmapW(IDB_BITMAP1);
BITMAP bmp;
bitmap.GetBitmap(&bmp);
m_button.SetBitmap(bitmap);
m_button.MoveWindow(30, 30, bmp.bmWidth, bmp.bmHeight);
void MyButton::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
int x = rand() % 400;
int y = rand() % 300;
this->MoveWindow(x, y, 100, 166);
CButton::OnMouseMove(nFlags, point);
}
网友评论