Results 1 to 6 of 6

Thread: Add A Size Grip

  1. #1

    Thread Starter
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    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.

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Add A Size Grip

    Quote 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."


  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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:
    1. Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" _
    2.  (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    3.  lParam As Any) As Long
    4. Private Declare Sub ReleaseCapture Lib "User32" ()
    5.  
    6. Private Const WM_NCLBUTTONDOWN = &HA1
    7. Private Const HTBOTTOMRIGHT = 17
    8.  
    9. Private Sub Form_Resize()
    10. 'position label in bottom right hand corner
    11. lblSizeGrip.Move Me.ScaleWidth - lblSizeGrip.Width, Me.ScaleHeight - lblSizeGrip.Height
    12. End Sub
    13.  
    14. Private Sub lblSizeGrip_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    15. ReleaseCapture
    16. SendMessage hwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, ByVal 0&
    17. End Sub

  4. #4
    Member
    Join Date
    Apr 2010
    Posts
    45

    Re: Add A Size Grip

    Quote Originally Posted by Hack View Post
    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:
    1. Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" _
    2.  (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    3.  lParam As Any) As Long
    4. Private Declare Sub ReleaseCapture Lib "User32" ()
    5.  
    6. Private Const WM_NCLBUTTONDOWN = &HA1
    7. Private Const HTBOTTOMRIGHT = 17
    8.  
    9. Private Sub Form_Resize()
    10. 'position label in bottom right hand corner
    11. lblSizeGrip.Move Me.ScaleWidth - lblSizeGrip.Width, Me.ScaleHeight - lblSizeGrip.Height
    12. End Sub
    13.  
    14. Private Sub lblSizeGrip_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    15. ReleaseCapture
    16. SendMessage hwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, ByVal 0&
    17. End Sub
    Nice! Really useful when you don't require a statusbar... Thanks.

  5. #5
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,229

    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.

  6. #6
    Member
    Join Date
    Apr 2010
    Posts
    45

    Re: Add A Size Grip

    I'll try them, thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width