2. http://www.mvps.org/vbvision/_samples/MDI_Background_Demo.zip MDI Background Demo.zip (25KB) This project shows how you can use memory device contexts to create pictures that can be assigned to the picture property of a VB MDI parent form. The project contains routines to stretch a bitmap across the background of the form and center a bitmap on top of a background as well as a routine for tiling a bitmap onto the background. It also contains code to draw transparent bitmaps that is used when overlaying a foreground bitmap onto the background. This project replaces a previous demo that used subclassing to attain a similar result. The routines in this project are generic enough that they can be used with any VB form or control that has a picture property.
http://www.mvps.org/vbvision/_samples/MDI_Background_Demo.zip
MDI Background Demo.zip (25KB)
This project shows how you can use memory device contexts to create pictures that can be assigned to the picture property of a VB MDI parent form. The project contains routines to stretch a bitmap across the background of the form and center a bitmap on top of a background as well as a routine for tiling a bitmap onto the background. It also contains code to draw transparent bitmaps that is used when overlaying a foreground bitmap onto the background. This project replaces a previous demo that used subclassing to attain a similar result. The routines in this project are generic enough that they can be used with any VB form or control that has a picture property.
子窗体.windowstate的属性值等于2就可以了
或者你也可以使用代码来控制。
至于图片问题我建议你使用填充背景的方法更好些,这样不会因为不同的分辨率而不同!
2。我的理解,picture的图片不会随picture的变化而变化,也没有必要,如果你想让图片发生大小变化,不要用picture
可以用PaintPicture 函数进行图片的缩放,不至于使图片变得失真太多。
先把图片取到一个PictureBox中,PictureBox1.autosize=ture
这时PictureBox1.width
PictureBox1.height 可以确定图片的原始大小。
然后用PaintPicture函数进行图片的缩放,具体用法:
form1.PaintPicture PictureBox1.picture, 0, 0, PictureBox1.Width, PictureBox1.Height, 0, 0, form1.Width, form1.Height(, vbSrcCopy)
解释:
form1.PaintPicture 假设你的窗体的名字为form1,那么在form1上绘制图形
PictureBox1.picture 要缩放的图片,已经取到PictureBox1中了
0, 0 原图片的坐标原点
PictureBox1.Width, PictureBox1.Height 缩放区为整个图片
0, 0 绘制区(本例为form1)的坐标原点
form1.Width, form1.Height 将图片放大到整个form1的范围
(, vbSrcCopy) 最后这个参数可缺省事用默认值
这个函数用得好可以做出很多意想不到的效果。
最后别忘了设置 PictureBox1.visible=false,把他隐藏起来。
可以接受PaintPicture函数的对象有form,picturebox
祝好运