|
-
Feb 22nd, 2002, 09:23 PM
#1
Thread Starter
Member
background picture
is there a way to make a form's picture property picture stretch along with the form?
-
Feb 23rd, 2002, 12:26 AM
#2
Stuck in the 80s
Use bitblt or stretchbit API.
-
Feb 23rd, 2002, 12:41 AM
#3
You can use the Forms PaintPicture() Method, i.e.
VB Code:
Option Explicit
Private Sub Form_Load()
Picture = LoadPicture("C:\SomeFile.bmp")
End Sub
Private Sub Form_Paint()
If Picture.Handle = 0 Then Exit Sub
' An Error Could Occur if the Form Size
' Becomes Invalid for the Paint Operation.
On Error GoTo Paint_Error
' Size the Form Picture to fit the
' Dimensions of the form.
PaintPicture _
Picture, _
0, 0, _
ScaleWidth, ScaleHeight, _
0, 0, _
ScaleX(Picture.Width, vbHimetric, ScaleMode), _
ScaleY(Picture.Height, vbHimetric, ScaleMode)
Paint_Error:
End Sub
Private Sub Form_Resize()
' Force the Form to Call the
' Paint Method on a Resize, as it
' will not always call a Paint when
' Down-sizing a Form.
Form_Paint
End Sub
-
Feb 23rd, 2002, 12:45 AM
#4
You could also just place a picture in an image box and size it to the form size
VB Code:
Option Explicit
Private Sub Form_Load()
Image1.Stretch = True
Image1.Picture = LoadPicture("C:\my picture.bmp")
End Sub
Private Sub Form_Resize()
Image1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
Image1.ZOrder 1
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|