美文网首页
按钮设置位图

按钮设置位图

作者: fffwc | 来源:发表于2020-10-08 10:33 被阅读0次

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

    }

    相关文章

      网友评论

          本文标题:按钮设置位图

          本文链接:https://www.haomeiwen.com/subject/dwbcpktx.html