|
-
Dec 13th, 2005, 01:56 PM
#1
Thread Starter
Frenzied Member
Add A Size Grip
When you add a status panel to a form, it also adds a size grip to the bottom right hand corner of the form.
Is there a way to get this size grip without using a status bar?
Beantown Boy
Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
-
Dec 13th, 2005, 02:06 PM
#2
Re: Add A Size Grip
 Originally Posted by SeanK
When you add a status panel to a form, it also adds a size grip to the bottom right hand corner of the form.
Is there a way to get this size grip without using a status bar?
Take a look at this post by Brian Hawley he came up with a thing he calls a "Shangle". Give it a try.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Dec 13th, 2005, 02:25 PM
#3
Re: Add A Size Grip
That attachment link by Brian Hawley doesn't seem to be working. Here is some code that I have that I don't remember where I got, but I've used it a ton of times.
Add a label to the form. Call it lblSizeGrip. In design, set the font to Marlett, the font style to Bold, the font size to 12, the mousepointer to 8 (Size NW SE), the caption to "p", the forecolor to &H00404040&, the alignment to center, and the backstyle to transparent. Size the label as small as possible.
VB Code:
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" ()
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTBOTTOMRIGHT = 17
Private Sub Form_Resize()
'position label in bottom right hand corner
lblSizeGrip.Move Me.ScaleWidth - lblSizeGrip.Width, Me.ScaleHeight - lblSizeGrip.Height
End Sub
Private Sub lblSizeGrip_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage hwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, ByVal 0&
End Sub
-
Jul 22nd, 2015, 05:49 PM
#4
Member
Re: Add A Size Grip
 Originally Posted by Hack
That attachment link by Brian Hawley doesn't seem to be working. Here is some code that I have that I don't remember where I got, but I've used it a ton of times.
Add a label to the form. Call it lblSizeGrip. In design, set the font to Marlett, the font style to Bold, the font size to 12, the mousepointer to 8 (Size NW SE), the caption to "p", the forecolor to &H00404040&, the alignment to center, and the backstyle to transparent. Size the label as small as possible.
VB Code:
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" ()
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTBOTTOMRIGHT = 17
Private Sub Form_Resize()
'position label in bottom right hand corner
lblSizeGrip.Move Me.ScaleWidth - lblSizeGrip.Width, Me.ScaleHeight - lblSizeGrip.Height
End Sub
Private Sub lblSizeGrip_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SendMessage hwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, ByVal 0&
End Sub
Nice! Really useful when you don't require a statusbar... Thanks.
-
Jul 24th, 2015, 07:41 AM
#5
Re: Add A Size Grip
Here's a couple classes I wrote. uses the API to draw themed and unthemed grips...
CSizeGrip.cls CSizeGrip.cls
CSizeGripLR.cls CSizeGripLR.cls
Code:
Dim grip as New CSizeGrip
Private Sub Form_Load()
grip.Attach Me
End Sub
several caviats... but probably the most important is that It automatically sets your form scalemode to pixels, and I don't think I ever rewote a version of this class to compensate for other scalemodes.
Somewhere I have a version that optionally uses the Marlett font method on the bottom left, used for resizing custom drop down lists like in Visual Studio's properties grid too if you need that.
Last edited by DEXWERX; Jul 24th, 2015 at 08:07 AM.
-
Jul 24th, 2015, 01:04 PM
#6
Member
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
|