Advertisement
5_2007-2008 Miscellaneous #175922

A Very Flat Std Command Button

Make a standard command button very flat ;-)

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
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
Original Comments (3)
Recovered from Wayback Machine