|
-
Feb 3rd, 2001, 01:28 AM
#1
Just use three pictureboxes, one label, one command button on the form, set the form's border style to none. Below is the code for it...
Private Sub Command1_Click()
Dim s As String
s = InputBox("Enter the Caption for Title Bar", "Title Bar Caption")
If s Like "" Then
Else
Label1.Caption = s
End If
Label1.Visible = True
Label1.Left = Me.ScaleLeft
Label1.Top = Me.ScaleTop
Label1.Width = Me.ScaleWidth
Picture1.Visible = True
Picture1.Top = Me.ScaleTop
End Sub
Private Sub Form_Resize()
Dim x, y, y1, y2, diff, diff1, diff2 As Integer
x = Me.ScaleWidth
y = Picture1.Width
y1 = Picture2.Width
y2 = Picture3.Width
diff = (x - y)
diff1 = (x - y) - y1
diff2 = (x - y) - (y1) - (y2)
Picture1.Move diff
Picture2.Move diff1
Picture3.Move diff2
Label1.Visible = True
Label1.Left = Me.ScaleLeft
Label1.Top = Me.ScaleTop
Label1.Width = Me.ScaleWidth
Picture1.Visible = True
Picture1.Top = Me.ScaleTop
Picture2.Visible = True
Picture2.Top = Me.ScaleTop
Picture3.Visible = True
Picture3.Top = Me.ScaleTop
End Sub
Private Sub Picture1_Click()
Unload Me 'Picture1 is a 'X' picture
End Sub
Private Sub Picture2_Click()
Static x As Integer
Dim pw As Integer
Dim y As Integer
x = x + 3
y = (x Mod 2)
'Picture2 is '+' Picture.
pw = Picture2.Width
If y <> 0 Then
Me.WindowState = 2
Picture2.Width = pw / 2
End If
If y = 0 Then
Me.WindowState = 0
Picture2.Width = pw * 2
End If
End Sub
Private Sub Picture3_Click()
Me.WindowState = 1 'Picture3 is '-' Picture.
End Sub
-
Feb 3rd, 2001, 01:41 AM
#2
Thatz ok.. but how do ya move the form?
-
Feb 3rd, 2001, 05:20 AM
#3
PowerPoster
-
Feb 3rd, 2001, 05:31 AM
#4
With SOme Modification!!!
'Okay just make some changes to the above for u to move the form. u can move the form by dragging the mouse over its focus area and not on the custom title bar control
Private Declare Function SendMessage Lib "User32" _
Alias "SendMessageA" (ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "User32" ()
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
'Add this code to the form's MouseMove procedure:
Private Sub Command1_Click()
'For Setting the Custom Title Bar Property
Dim s As String
s = InputBox("Enter the Caption for Title Bar", "Title Bar Caption")
If s Like "" Then
Else
Label1.Caption = s
End If
Label1.Visible = True
Label1.Left = Me.ScaleLeft
Label1.Top = Me.ScaleTop
Label1.Width = Me.ScaleWidth
Picture1.Visible = True
Picture1.Top = Me.ScaleTop
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lngReturnValue As Long
If Button = 1 Then
Call ReleaseCapture
lngReturnValue = SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, _
HTCAPTION, 0&)
End If
End Sub
Private Sub Form_Resize()
'The various variables are taken for adjusting the Picture Boxes
Dim X, Y, y1, y2, diff, diff1, diff2 As Integer
X = Me.ScaleWidth
Y = Picture1.Width
y1 = Picture2.Width
y2 = Picture3.Width
'The variables for trapping the differential width of the picture boxes
diff = (X - Y)
diff1 = (X - Y) - (y1)
diff2 = (X - Y) - (y1) - (y2)
Picture1.Move diff
Picture2.Move diff1
Picture3.Move diff2
Label1.Visible = True
Label1.Left = Me.ScaleLeft
Label1.Top = Me.ScaleTop
Label1.Width = Me.ScaleWidth
'Moving the Picture Boxes to relative positions
Picture1.Visible = True
Picture1.Top = Me.ScaleTop
Picture2.Visible = True
Picture2.Top = Me.ScaleTop
Picture3.Visible = True
Picture3.Top = Me.ScaleTop
End Sub
Private Sub Picture1_Click()
Unload Me
End Sub
Private Sub Picture2_Click()
'Toggling the Picture2 Control that is to fire for the Form_Resize Event
Static X As Integer
Dim pw As Integer 'Changing the Picture Width as to adjust for Form_Resize Event
Dim Y As Integer
X = X + 3
Y = (X Mod 2)
pw = Picture2.Width
If Y <> 0 Then
Me.WindowState = 2
Picture2.Width = (pw / 2) 'Readjusting the Picture2's Width
End If
If Y = 0 Then
Me.WindowState = 0
Picture2.Width = (pw * 2) 'Readjusting the Picture2's width.
End If
End Sub
Private Sub Picture3_Click()
Me.WindowState = 1
End Sub
-
Feb 3rd, 2001, 06:00 AM
#5
but you had to use API.. It just exerts.. No windows app is complete w/o API
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
|