Search Tools Links Login

A Very Flat Std Command Button


Visual Basic 6, or VB Classic

Make a standard command button very flat ;-)

Original Author: Ulli

Code

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

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 131 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.