16,216
社区成员
发帖
与我相关
我的任务
分享
m_pLabel = new QLabel(this);
m_pLabel->setAutoFillBackground(true);
m_pLabel->setScaledContents(true);
QPixmap pixmap;
if (pixmap.load("C:\\Users\\Administrator\\Documents\\Visual Studio 2010\\Projects\\MineSweerer\\MineSweerer\\Resources\\block.png"))
{
m_pLabel->setPixmap(pixmap);
}
else
{
QMessageBox::warning(NULL, "no resource", "no resource");
}
//重绘事件
void KBlock::paintEvent(QPaintEvent *pEvent)
{
m_pLabel->resize( this->size() );
}