按钮设置位图

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);

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。