|
-
Aug 8th, 2002, 07:34 AM
#1
Thread Starter
Junior Member
Resize form
Im looking to add a image to the form, so when its clicked it resizes the form. Just like the bit at the bottom right of winamp 3 (for an image of the button im talking about view the attachment), without having to have the whole status bar.
is is possible?
chadwick
-
Aug 8th, 2002, 07:36 AM
#2
-= B u g S l a y e r =-
Private Sub Image1_Click()
Me.Move 45, 43, 2000, 2000
End Sub
-
Aug 8th, 2002, 07:39 AM
#3
Thread Starter
Junior Member
what did that do?
thats not what im looking for, im looking to make it the same as if i had a resizable border.
-
Aug 8th, 2002, 07:42 AM
#4
-= B u g S l a y e r =-
Re: what did that do?
Originally posted by ChAdWiCk
Im looking to add a image to the form, so when its clicked it resizes the form....
thats what the code do , but its obv. not what you want
-
Aug 8th, 2002, 07:44 AM
#5
Thread Starter
Junior Member
im looking to make it the same as if i had a resizable border. know how to do it
-
Aug 8th, 2002, 07:50 AM
#6
Software Eng.
Not quite sure what you mean. You want to be able to resize an image just like how you would drag a Form? (e.g. by clicking on its borders and dragging it)
-
Aug 8th, 2002, 07:53 AM
#7
Thread Starter
Junior Member
no resize the form. do the exact same thing as if i had a resizeable border (but i dont).
what im going to do is put an image in the bottom right corner. so that if its clicked, you can use the form just like to would if u had clicked the reszable border of the form.
-
Aug 8th, 2002, 08:06 AM
#8
Software Eng.
This will take care of the dragging.
VB Code:
Dim OldX As Single
Dim OldY As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
OldX = X
OldY = Y
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then Me.Move Me.Left + (X - OldX), Me.Top + (Y - OldY)
End Sub
-
Aug 8th, 2002, 08:13 AM
#9
Thread Starter
Junior Member
close, that code moves the form. Im hoping that i can get it to resize the form.
-
Aug 8th, 2002, 09:18 AM
#10
Software Eng.
Here's some code from Aaron Young that drags and moves a borderless Form. It's doesn't do exactly what you want, but if you fiddle with it for a bit, you could probably get it working.
VB Code:
Public Sub DragControl(ByRef oControl As Object, ByVal Button As Integer, ByVal X As Single, ByVal Y As Single, Optional ByVal bInit As Boolean, Optional ByVal bMoveable As Boolean, Optional ByVal bResizable As Boolean)
Static lXoff As Single, lYoff As Single, bSizing As Boolean
Dim bBoth As Boolean, bSized As Boolean
If bInit Then
If (Y > (oControl.Height - 150) Or X > (oControl.Width - 150)) And bResizable Then
bSizing = True
End If
lXoff = X
lYoff = Y
Exit Sub
End If
If bResizable Then
bBoth = True
If Y > (oControl.Height - 150) Then
oControl.MousePointer = vbSizeNS
Else
bBoth = False
End If
If X > (oControl.Width - 150) Then
oControl.MousePointer = IIf(bBoth, vbSizeNWSE, vbSizeWE)
Else
If Not bBoth Then oControl.MousePointer = vbDefault
End If
End If
If bResizable And bSizing Then
If Button = vbLeftButton Then
If (Y > (oControl.Height - 150) Or X > (oControl.Width - 150)) Then
bBoth = True
If Y > (oControl.Height - 150) Then
oControl.MousePointer = vbSizeNS
If Button = vbLeftButton Then
oControl.Height = oControl.Height + Y - lYoff
lYoff = oControl.Height
lXoff = oControl.Width
bSized = True
End If
Else
bBoth = False
End If
If X > (oControl.Width - 150) Then
oControl.MousePointer = IIf(bBoth, vbSizeNWSE, vbSizeWE)
If Button = vbLeftButton Then
oControl.Width = oControl.Width + X - lXoff
lYoff = oControl.Height
lXoff = oControl.Width
bSized = True
End If
End If
End If
Else
oControl.MousePointer = vbDefault
bSizing = False
End If
End If
If Not bSized And bMoveable And Not bSizing Then
If Button = vbLeftButton Then oControl.Move oControl.Left + X - lXoff, oControl.Top + Y - lYoff
End If
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
DragControl Form1, Button, X, Y, True, True, True
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
DragControl Form1, Button, X, Y, False, True, True
End Sub
-
Aug 8th, 2002, 06:13 PM
#11
Thread Starter
Junior Member
thanks
thanks for that anyways, i will see what i can do with the code.
chad
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
|