VB icon

A Very Flat Std Command Button

Submitted on: 2/8/2015 11:17:00 PM
By: ULLI (from psc cd)  
Level: Intermediate
User Rating: By 3 Users
Compatibility: VB 6.0
Views: 1951
     Make a standard command button very flat ;-)
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
' Name: A Very Flat Std Command Button
' Description:Make a standard command button very flat ;-)
' By: ULLI (from psc cd)

Option Explicit
Private Type RECT
LeftAs Long
Top As Long
RightAs Long
Bottom As Long
End Type
Private WindowRectAs 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 SnippOffAs 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

Other 88 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.