送分100分:如何让小图片拉伸至整个屏幕
VB6中,使用PICTRUEBOX或IMAGE控件,如何让加载在其中的小图片拉伸至整个屏幕大小(当然不覆盖窗体边框、菜单栏、工具栏和状态栏的空间)。 --------------------编程问答--------------------Private Sub Form_Load()--------------------编程问答--------------------
Image1.Stretch = True
Image1.Move 0, 0, Screen.Width, Screen.Height
End Sub
Private Sub Form_Load()--------------------编程问答-------------------- 用image控件很简单,但用picture控件就麻烦点
Image1.Stretch = True
End Sub
Private Sub Form_Resize()
Image1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
End Sub
Dim TmpPic As IPictureDisp
Private Sub Picture1_Paint()
Picture1.PaintPicture TmpPic, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
End Sub
Private Sub Form_Load()
Set TmpPic = LoadPicture("d:\a.jpg")
End Sub
Private Sub Form_Resize()
Picture1.Move 0, 0, Me.Width, Me.Height
Call Picture1_Paint
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set TmpPic = Nothing
End Sub
--------------------编程问答--------------------
'将图片放于ImageList1里--------------------编程问答-------------------- 办法多的是…………
Private Sub Form_Load()
Picture1.AutoRedraw = True
Me.WindowState = 2
End Sub
Private Sub Form_Resize()
Picture1.Move 0, 0, Me.Width, Me.Height
Picture1.PaintPicture ImageList1.ListImages(1).Picture, 0, 0, Me.Width, Me.Height
End Sub
在 Form_Resize()事件 中处理就行。
固定大小的窗体可以在 Form_Load() 中处理。
--------------------编程问答-------------------- 变形后岂不是很难看?? --------------------编程问答-------------------- 这个不难吧。顶了。 --------------------编程问答-------------------- --------------------编程问答-------------------- 这东西简单,就是扯大了比例失调很难看 --------------------编程问答-------------------- Me.PaintPicture Picture1.Picture, 0, 0, Me.ScaleWidth, Me.ScaleHeight
0,0是XY座标位置(我可不知道你上面那些工具栏的宽高), 与后面两个参数是宽高度, 自己定.
Option Explicit
Private Sub Form_Load()
Me.Width = Screen.Width
Me.Height = Screen.Height
Me.AutoRedraw = True
Me.Move 0, 0
End Sub
Private Sub Form_Click()
Me.PaintPicture Picture1.Picture, 0, 0, Me.ScaleWidth, Me.ScaleHeight
Picture1.Move Screen.Width
End Sub --------------------编程问答--------------------
补充:VB , 网络编程