VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Add a size grid to VB form

by Waty Thierry (60 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Tue 30th March 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Add a size grid to VB form

API Declarations


' * Programmer Name : Waty Thierry
' * Web Site : www.geocities.com/ResearchTriangle/6311/
' * E-Mail : [email protected]
' * Date : 13/10/98
' * Time : 10:24
' * Module Name : Form_Module
' * Module Filename : Form.bas
' **********************************************************************
' * Comments :
' * Add a size grid to VB form
' **********************************************************************

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Declare Function DrawFrameControl Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal un1 As Long, ByVal un2 As Long) As Long
Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long

Private Const DFCS_SCROLLSIZEGRIP = &H8
Private Const DFC_SCROLL = 3


Rate Add a size grid to VB form



' * Programmer Name  : Waty Thierry
' * Web Site         : www.geocities.com/ResearchTriangle/6311/
' * E-Mail           : [email protected]
' * Date             : 13/10/98
' * Time             : 10:24
' * Module Name      : Form_Module
' * Module Filename  : Form.bas
' **********************************************************************
' * Comments         :
' * Add a size grid to VB form
' **********************************************************************

Private Sub cmdClose_Click()
   Unload Me
End Sub

Private Sub Form_Resize()
   
   Dim rct As RECT
   
   On Error Resume Next
   'This is necessary as the form could be made too small
   'for the controls.  This could be overcome by adding some
   'code to handle this eventuality.
   
   'reposition/resize the controls
   cmdClose.Left = ScaleWidth - (cmdClose.Width + (8 * Screen.TwipsPerPixelX))
   With List1
      .Width = ScaleWidth - (cmdClose.Width + (24 * Screen.TwipsPerPixelX))
      .Height = ScaleHeight - (16 * Screen.TwipsPerPixelY)
   End With
   
   Cls
   
   'Draw the size grip
   GetClientRect Me.hwnd, rct
   With rct
      .Left = .Right - 17
      .Top = .Bottom - 17
      DrawFrameControl Me.hdc, rct, DFC_SCROLL, DFCS_SCROLLSIZEGRIP
   End With
   
End Sub



Download this snippet    Add to My Saved Code

Add a size grid to VB form Comments

No comments have been posted about Add a size grid to VB form. Why not be the first to post a comment about Add a size grid to VB form.

Post your comment

Subject:
Message:
0/1000 characters