Dark border around default command button 
Author Message
 Dark border around default command button

Hi,

I'm trying to get rid of the dark border around a command button when you
set it to default.  I'd still like it to be default but without the border.
Does anyone know how to do this?

TIA

Glen Conway



Tue, 09 Sep 2003 23:03:41 GMT  
 Dark border around default command button
On Fri, 23 Mar 2001 15:03:41 -0000, "Glen Conway"
Quote:

>I'm trying to get rid of the dark border around a command button when you
>set it to default.  I'd still like it to be default but without the border.
>Does anyone know how to do this?

One work-around would be to move the default button out of sight
(Left= -2000 or whatever, tabstop=false) and an additional button on
the form to represent the UI action. Otherwise you could set the
button's Style to graphical, subclass it, and draw it yourself (not
trivial), or make your own button with a usercontrol and the
DrawFrameControl API function (also not trivial).
More importantly, why do it at all? It would essentially hide the fact
from the user that the button is the default. (Some users actually pay
attention to those sort of clues <g>).

-Tom
(please post replies to the newsgroup)



Wed, 10 Sep 2003 02:25:31 GMT  
 Dark border around default command button
An easy to do this would be to not set the button as default. Just set the
form's KeyPreview property to True and trap the enter key in the
Form_KeyPress event.

Example (Form.KeyPreview = True):

Private Sub Form_KeyPress(KeyAscii As Integer)

    If KeyAscii = vbKeyReturn Then
        'If the user has focus on another button, you can't
        'click the default button when they press enter.
        'This would be completely unexpected by the user.
        If Not TypeOf Me.ActiveControl Is CommandButton Then
            'ActiveControl is Not a button.
            'Click the Default button
            MyDefButton.Value = True
        End If
    End If

End Sub

Rocky Clark (Kath-Rock Software)


Quote:
> Hi,

> I'm trying to get rid of the dark border around a command button when you
> set it to default.  I'd still like it to be default but without the
border.
> Does anyone know how to do this?

> TIA

> Glen Conway



Wed, 10 Sep 2003 20:33:29 GMT  
 Dark border around default command button
Thanks Guys - I guess all it takes is a little ingenuity ;)  The reason I
wanted to hide the border was that it spoiled the look of the ui and as
there is only one command button on this form the user would need to know it
was the default.

Cheers

Glen


Quote:
> An easy to do this would be to not set the button as default. Just set the
> form's KeyPreview property to True and trap the enter key in the
> Form_KeyPress event.

> Example (Form.KeyPreview = True):

> Private Sub Form_KeyPress(KeyAscii As Integer)

>     If KeyAscii = vbKeyReturn Then
>         'If the user has focus on another button, you can't
>         'click the default button when they press enter.
>         'This would be completely unexpected by the user.
>         If Not TypeOf Me.ActiveControl Is CommandButton Then
>             'ActiveControl is Not a button.
>             'Click the Default button
>             MyDefButton.Value = True
>         End If
>     End If

> End Sub

> Rocky Clark (Kath-Rock Software)



> > Hi,

> > I'm trying to get rid of the dark border around a command button when
you
> > set it to default.  I'd still like it to be default but without the
> border.
> > Does anyone know how to do this?

> > TIA

> > Glen Conway



Wed, 10 Sep 2003 21:49:43 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. command button borders

2. Making the caption on command button wrap around

3. Desktop image bleeding through around command buttons

4. Desktop image bleeding through around command buttons

5. Desktop image bleeding through around command buttons

6. Microsoft Graph Chart has white band around border

7. Default Command Button

8. Trouble setting default command button?

9. Command Button Default property problem

10. Default command buttons bypassing LostFocus

11. Print a border around a picture

12. Command Button 'Default' Property

 

 
Powered by phpBB® Forum Software