ID: 285
Viewed: 2763
Added: Jul 26, 2002
Version:
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty
Getting the Office Look
Fancy giving your application that Office 2000 feel?
Get with it by giving all your controls a groovy new Office 2000-like border style, all thanks to this neat copy-and-paste code snippet.
This code uses the API to alter the border of a control, giving it a very faint and rather cool-looking 3D border.
For best results, change the Appearance and BorderStyle properties of your control(s) to Flat and None, respectively.
To run this code, simply call the AddOfficeBorder method, passing it the hWnd property of your control.
Sample Usage
AddOfficeBorder(Text1.hWnd)
Fancy giving your application that Office 2000 feel?
Get with it by giving all your controls a groovy new Office 2000-like border style, all thanks to this neat copy-and-paste code snippet.
This code uses the API to alter the border of a control, giving it a very faint and rather cool-looking 3D border.
For best results, change the Appearance and BorderStyle properties of your control(s) to Flat and None, respectively.
To run this code, simply call the AddOfficeBorder method, passing it the hWnd property of your control.
Sample Usage
AddOfficeBorder(Text1.hWnd)
Highlight all by clicking in box
<!---Declaration--->
none
Highlight All
<!---Code--->
' Insert this code into a module
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
ByVal CX As Long, ByVal CY As Long, ByVal wFlags As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_CLIENTEDGE = &H200
Private Const WS_EX_STATICEDGE = &H20000
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOOWNERZORDER = &H200
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Public Function AddOfficeBorder(ByVal hWnd As Long)
Dim lngRetVal As Long
'Retrieve the current border style
lngRetVal = GetWindowLong(hWnd, GWL_EXSTYLE)
'Calculate border style to use
lngRetVal = lngRetVal Or WS_EX_STATICEDGE And Not WS_EX_CLIENTEDGE
'Apply the changes
SetWindowLong hWnd, GWL_EXSTYLE, lngRetVal
SetWindowPos hWnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or _
SWP_NOOWNERZORDER Or SWP_NOZORDER Or SWP_FRAMECHANGED
End Function
;
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.