by ULLI (93 Submissions)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)
Make a standard command button very flat ;-)
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private WindowRect As RECT
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Sub Form_Load()
Const SnippOff As Long = 3
Dim hRgn As Long
With WindowRect
.Left = SnippOff
.Top = SnippOff
.Right = ScaleX(Command1.Width, ScaleMode, vbPixels) - SnippOff
.Bottom = ScaleY(Command1.Height, ScaleMode, vbPixels) - SnippOff
hRgn = CreateRectRgn(.Left, .Top, .Right, .Bottom)
SetWindowRgn Command1.hWnd, hRgn, True
DeleteObject hRgn
End With
End Sub