然后设置Picture属性就可以了,设置Stretch属性为True,然后就可以通过改动Image控件的大小来调整图片显示的大小了。
//
// label1
//
this.label1.Image = global::WindowsFormsApplication1.Properties.Resources.搜狗浏览器截图
this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
this.label1.Location = new System.Drawing.Point(164, 200)
this.label1.Name = "label1"
this.label1.Size = new System.Drawing.Size(67, 23)
this.label1.TabIndex = 2
this.label1.Text = "主页"
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
void ScrollArea::set_image(char *filename){
QImage *ppm = new QImage(filename)
label = new QLabel()
printf("ppm->width()=%d, ppm->height()=%d\n",ppm->width(), ppm->height())//获取图片的宽度和高度
label->setPixmap(QPixmap::fromImage(*ppm))
this->setWidget(label)
/*设置窗口最大高度和宽度为1024*768*/
this->setMaximumHeight(768)
this->setMaximumWidth(1024)
this->resize(QSize( ppm->width()+5, ppm->height() +5))
return
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)