Focus rectangle in a command button

Is there a simple way to eliminate the focus rectangle from appearing when you select a command button?

I do realize that I can move focus from the command button, but the rectangle will still show when you press down on the button, and it messes up what I am trying to do.
LVL 2
taplinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AnswerTheManCommented:
use another control.
0
vbWayneCommented:
..a click is a click...
by any other name...
0
Erick37Commented:
Add the MS Forms 2.0 Object Library control ToggleButton to the form.  Warning: the DLL is pretty large.

Private Sub ToggleButton1_Click()
    If ToggleButton1.Value Then
        ToggleButton1.Value = False
        'Click event code here
        Debug.Print "Click"
    End If
End Sub
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Erick37Commented:
Actually, the ToggleButton does not solve the problem...
There is no focus rect until you add a Caption, then it appears... duh.
0
Erick37Commented:
Ok, another try.
You can use the DrawEdge API to create your own command button from a picture box.

" HOWTO: Perform 3-D Line Drawing in Win32 with DrawEdge"

http://support.microsoft.com/support/kb/articles/q142/1/72.asp
0
adityauCommented:
You can even use SSPanel control of Sheridian 3D controls
0
VBGuruCommented:
check out
Option Explicit
Private Declare Function DrawFocusRect Lib "user32" (ByVal hdc As Long, lpRect As RECT) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
Private a As RECT

Private Sub Command1_Click()
With a
    .Top = 4
    .Left = 4
    .Bottom = Command1.Height - 4
    .Right = Command1.Width - 4
End With
DrawFocusRect GetDC(Command1.hwnd), a
End Sub
0
taplinAuthor Commented:
VBGuru, I do thank you for your answer, but unfortunately, it does not seem to do what I was aiming for.  When I click the button, the focus rectangle is redrawn on top of the other, but it is not completely XORed (or whatever method they use).  It leaves a light gray line around the outside now.

I've played around for a few minutes, but can't seem to get it to work.

Thank you, though.
Jay
0
VBGuruCommented:
It works
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Sub Command1_Click()
SendMessage Command1.hwnd, 7, 0&, 0&
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
taplinAuthor Commented:
THANK YOU THANK YOU THANK YOU!!!!
I knew I had seen an API call before that did this, yet I couldn't find it, or even a constant that looked like it would do it.

I really appreciate it.

Jay
0
VBGuruCommented:
welcome. Happy to see your comment.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.