一个人的回复是这样的: 如果你想要图片会随窗体大小变化而变化,则Copy下面的代码 需要一个PictureBoxPrivate Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As LongPrivate Sub Form_Load() Me.AutoRedraw = True Picture1.Picture=LoadPicture("你想要的背景图片") Picture1.AutoSize=True Picture1.AutoReDraw=True Picture1.Visible=False End SubPrivate Sub Form_Resize() StretchBlt Me.hdc, 0, 0, Me.ScaleWidth / Screen.TwipsPerPixelX, Me.ScaleHeight / Screen.TwipsPerPixelY, Picture1.hdc, 0, 0, Picture1.Width / Screen.TwipsPerPixelX, Picture1.Height / Screen.TwipsPerPixelY, vbSrcCopy Me.Refresh End Sub 他的Form_Resize没有看懂啊
如果你想要图片会随窗体大小变化而变化,则Copy下面的代码
需要一个PictureBoxPrivate Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As LongPrivate Sub Form_Load()
Me.AutoRedraw = True
Picture1.Picture=LoadPicture("你想要的背景图片")
Picture1.AutoSize=True
Picture1.AutoReDraw=True
Picture1.Visible=False
End SubPrivate Sub Form_Resize()
StretchBlt Me.hdc, 0, 0, Me.ScaleWidth / Screen.TwipsPerPixelX, Me.ScaleHeight / Screen.TwipsPerPixelY, Picture1.hdc, 0, 0, Picture1.Width / Screen.TwipsPerPixelX, Picture1.Height / Screen.TwipsPerPixelY, vbSrcCopy
Me.Refresh
End Sub
他的Form_Resize没有看懂啊
随form变化大小图片是一个中国地图。点击每个省市的就会弹出每个省市的详细地图。
我是在每个省市上放上透明无边框的lable控件,在lableclick事件里添加显示代码.以前是中国地图随form不变,相对的每个lable事件的位置是固定的。但现在图随form固定,而lable的位置不变,这样点击的时候位置就不对了。那位大虾能帮忙怎么解决才好呢
谢谢~~
继续关注楼下的更好的设计思路。