Home All Groups Group Topic Archive Search About
Author
20 Oct 2005 12:33 AM
Arpan
Usually when a CommandButton on a VB6 Form is clicked, a square (with
all the 4 sides having dotted lines) appears on the just clicked
CommandButton. Is there any way to get rid of that square on the
CommandButton?

Thanks,

Arpan

Author
20 Oct 2005 12:43 AM
Veign
Why would you?

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


Show quote
"Arpan" <arpan***@hotmail.com> wrote in message
news:1129768422.778144.76410@f14g2000cwb.googlegroups.com...
> Usually when a CommandButton on a VB6 Form is clicked, a square (with
> all the 4 sides having dotted lines) appears on the just clicked
> CommandButton. Is there any way to get rid of that square on the
> CommandButton?
>
> Thanks,
>
> Arpan
>
Author
20 Oct 2005 12:44 AM
Jim Edgar
"Arpan" <arpan***@hotmail.com> wrote in message
news:1129768422.778144.76410@f14g2000cwb.googlegroups.com...
> Usually when a CommandButton on a VB6 Form is clicked, a square (with
> all the 4 sides having dotted lines) appears on the just clicked
> CommandButton. Is there any way to get rid of that square on the
> CommandButton?
>
> Thanks,
>
> Arpan
>

It's called a focus rect!  You can't get rid of it!

Jim Edgar!
Author
20 Oct 2005 2:29 AM
Jim Carlock
If there's another control on the form, you can do the
following:

Private Sub Command1_Click()
  'Do all the stuff you need to for the Click event, then set focus upon
  'another control... The dotted lines appear ONLY while the button
  'is pressed down and disappear when focus is set to another
  'control. So set the focus to another control as the last item of the
  '_Click or DoubleClick event.
  Call Text1.SetFocus
End Sub

The rectangle is noticed for a moment and ends up disappearing.

Another option would be to use the Command1_MouseUp
event to set focus upon another control.

Yet another option that might work for you involves using a
PictureBox control and capturing a picture of the command
button. The HTML Help Image Editor works great for getting
a picture of any control or form. You can edit the picture
captured of the pressed button to get rid of the dotted rect
and switch between loading the pressed and unpressed images.

For the PictureBox, get rid of the Border, set the Appearance
property to a flat look instead of 3-D, set the AutoSize to True.

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  Picture1.Picture = LoadResPicture(1001, vbResBitmap)
  'Picture1.Picture = LoadPicture(AppendBackSlash(App.Path) & "Cmd1_P.bmp")
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  Picture1.Picture = LoadResPicture(1002, vbResBitmap)
  'Picture1.Picture = LoadPicture(AppendBackSlash(App.Path) & "Cmd1_U.bmp")
End Sub

Hope this helps.

--
Jim Carlock
Post replies to the newsgroup, thanks.

"Jim Edgar @cox.net>" <djedgar<removethis> wrote:

"Arpan" <arpan***@hotmail.com> wrote:
> Usually when a CommandButton on a VB6 Form is clicked, a square (with
> all the 4 sides having dotted lines) appears on the just clicked
> CommandButton. Is there any way to get rid of that square on the
> CommandButton?
>
> Thanks,
>
> Arpan
>

It's called a focus rect!  You can't get rid of it!

Jim Edgar!
Author
20 Oct 2005 2:32 AM
alpine
Show quote
>"Arpan" <arpan***@hotmail.com> wrote in message
>news:1129768422.778144.76410@f14g2000cwb.googlegroups.com...
>> Usually when a CommandButton on a VB6 Form is clicked, a square (with
>> all the 4 sides having dotted lines) appears on the just clicked
>> CommandButton. Is there any way to get rid of that square on the
>> CommandButton?
>>
>> Thanks,
>>
>> Arpan
>>
>
>It's called a focus rect!  You can't get rid of it!
>
>Jim Edgar!

Well.....   Actually, you can (but maybe shouldn't).  ;-)

For an example of how it's done, have a look at the Remove Focused
Rect example at  http://www.mvps.org/vbvision/

HTH,
Bryan
_______________________________
Bryan Stafford
New Vision Software
newvision_don'tspam@mvps.org
Author
20 Oct 2005 2:35 AM
Jim Carlock
I didn't find the words: Rectangle or Focus on the page...

  http://www.mvps.org/vbvision/

I found "Remove" but I'm not going to give you any points
for those "Remove"'s.

--
Jim Carlock
Post replies to the newsgroup, thanks.

Show quote
"alpine" <alpine_don'tsendspam@mvps.org> wrote:
>"Arpan" <arpan***@hotmail.com> wrote in message
>news:1129768422.778144.76410@f14g2000cwb.googlegroups.com...
>> Usually when a CommandButton on a VB6 Form is clicked, a square (with
>> all the 4 sides having dotted lines) appears on the just clicked
>> CommandButton. Is there any way to get rid of that square on the
>> CommandButton?
>>
>> Thanks,
>>
>> Arpan
>>
>
>It's called a focus rect!  You can't get rid of it!
>
>Jim Edgar!

Well.....   Actually, you can (but maybe shouldn't).  ;-)

For an example of how it's done, have a look at the Remove Focused
Rect example at  http://www.mvps.org/vbvision/

HTH,
Bryan
_______________________________
Bryan Stafford
New Vision Software
newvision_don'tspam@mvps.org
Author
20 Oct 2005 2:46 AM
Jim Carlock
Google found it...

   remove focused rectangle site:mvps.org/vbvision

http://www.mvps.org/vbvision/grouped_demos.htm

--
Jim Carlock
Post replies to the newsgroup, thanks.
Author
20 Oct 2005 5:23 AM
Arpan
Thanks all of you for your inputs.

Regards,

Arpan
Author
20 Oct 2005 8:38 AM
Fatih Argun
'Try this

Private Const WM_KILLFOCUS As Long = &H8
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_GotFocus()
    SendMessage Command1.hwnd, WM_KILLFOCUS, 0, 0
End Sub
Author
20 Oct 2005 12:55 PM
Jeff Johnson [MVP: VB]
"Arpan" <arpan***@hotmail.com> wrote in message
news:1129768422.778144.76410@f14g2000cwb.googlegroups.com...

> Usually when a CommandButton on a VB6 Form is clicked, a square (with
> all the 4 sides having dotted lines) appears on the just clicked
> CommandButton. Is there any way to get rid of that square on the
> CommandButton?

Unless you're creating a touch-screen application, DON'T DO IT. This
rectangle is important to people who use the keyboard. Believe it or not,
there are people out there who prefer the keyboard over the mouse. Good
programmers accommodate ALL their users.
Author
20 Oct 2005 4:11 PM
Stefan Berglund
On Thu, 20 Oct 2005 08:55:33 -0400, "Jeff Johnson [MVP: VB]" <i.get@enough.spam>
wrote:
in <e9XUQWX1FHA.2***@TK2MSFTNGP09.phx.gbl>

Show quote
>
>"Arpan" <arpan***@hotmail.com> wrote in message
>news:1129768422.778144.76410@f14g2000cwb.googlegroups.com...
>
>> Usually when a CommandButton on a VB6 Form is clicked, a square (with
>> all the 4 sides having dotted lines) appears on the just clicked
>> CommandButton. Is there any way to get rid of that square on the
>> CommandButton?
>
>Unless you're creating a touch-screen application, DON'T DO IT. This
>rectangle is important to people who use the keyboard. Believe it or not,
>there are people out there who prefer the keyboard over the mouse. Good
>programmers accommodate ALL their users.
>

Mouse?  What's that?  Oh, you mean that carpal tunnel inducing device?

---
Stefan Berglund
Author
20 Oct 2005 4:28 PM
Rick Rothstein [MVP - Visual Basic]
> Mouse?  What's that?  Oh, you mean that carpal tunnel inducing
device?

What... you don't think a keyboard can contribute to carpal tunnel
problems?

Rick
Author
20 Oct 2005 4:47 PM
Ken Halter
"Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@NOSPAMcomcast.net>
wrote in message news:u8SMFNZ1FHA.3376@TK2MSFTNGP14.phx.gbl...
>> Mouse?  What's that?  Oh, you mean that carpal tunnel inducing
> device?
>
> What... you don't think a keyboard can contribute to carpal tunnel
> problems?
>
> Rick

I tell ya.... I've been "computing" for 25 years... never had a problem...
then, I got a laptop. Now I have problems (mostly sore wrists).

If it weren't so darned cumbersome, I'd have a "real" keyboard (link to best
keyboard on earth below) hooked up to my laptop at all times.... but then,
I'd have a "desktop" and I could've saved a few bucks eh? <g>

I use a white one at home and a black one at work.
http://www.microsoft.com/hardware/mouseandkeyboard/productdetails.aspx?pid=021

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..
Author
20 Oct 2005 5:52 PM
Mike Williams
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:%23f2XoXZ1FHA.2008@TK2MSFTNGP10.phx.gbl...

> I use a white one at home [keyboard] and a black one at work.

Is that so you'll remember where you are? Must be a "cushy" job :-)

Mike
Author
20 Oct 2005 6:16 PM
Ken Halter
"Mike Williams" <M***@WhiskyAndCoke.com> wrote in message
news:dj8lga$afg$1@news6.svr.pol.co.uk...
> "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
> news:%23f2XoXZ1FHA.2008@TK2MSFTNGP10.phx.gbl...
>
>> I use a white one at home [keyboard] and a black one at work.
>
> Is that so you'll remember where you are? Must be a "cushy" job :-)
>
> Mike

LOL <g>... nah, it's actually because I have a black PC/Monitor at work and
a "cream" colored at home.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..
Author
21 Oct 2005 1:36 AM
Stefan Berglund
On Thu, 20 Oct 2005 12:28:13 -0400, "Rick Rothstein [MVP - Visual Basic]"
<rickNOSPAMnews@NOSPAMcomcast.net> wrote:
in <u8SMFNZ1FHA.3***@TK2MSFTNGP14.phx.gbl>

>> Mouse?  What's that?  Oh, you mean that carpal tunnel inducing
>device?
>
>What... you don't think a keyboard can contribute to carpal tunnel
>problems?
>
>Rick
>

I've used a keyboard for 35 years and played the piano for 53 years and never
have a problem unless I forget and start clicking the mouse.  Then my fingers go
numb.  I normally use keyboard shortcuts for everything and no problem.

---
Stefan Berglund
Author
21 Oct 2005 3:05 AM
Jim Carlock
"Stefan Berglund" <keepit@in.thegroups> stated...
> I've used a keyboard for 35 years and played the piano for
> 53 years .... I normally use keyboard shortcuts for
> everything and no problem.

Yeah, those are neat pianos with the keyboard shortcut that
makes the piano play the song by itself...

--
Jim Carlock
Post replies to the newsgroup, thanks.
Author
21 Oct 2005 5:24 PM
Stefan Berglund
On Thu, 20 Oct 2005 23:05:08 -0400, "Jim Carlock" <anonymous@localhost> wrote:
in <eL8X1ye1FHA.3***@TK2MSFTNGP12.phx.gbl>

>"Stefan Berglund" <keepit@in.thegroups> stated...
>> I've used a keyboard for 35 years and played the piano for
>> 53 years .... I normally use keyboard shortcuts for
>> everything and no problem.
>
>Yeah, those are neat pianos with the keyboard shortcut that
>makes the piano play the song by itself...

LOL.  Disklavier is a great learning tool for students because it can reproduce
touch and feel with such exactness, but it lacks personality and doesn't do
requests.

---
Stefan Berglund

AddThis Social Bookmark Button