Results 1 to 11 of 11

Thread: [RESOLVED] Remove the checker border from command button

  1. #1

    Thread Starter
    Addicted Member scottlafoy's Avatar
    Join Date
    Feb 2009
    Location
    Calgary Alberta, Canada
    Posts
    148

    Resolved [RESOLVED] Remove the checker border from command button

    Hi, this may be a dumb question but, I have an intro form to my project and it has only 2 command buttons and nothing else. The form is displaying a picture in the back ground and the buttons both have pictures. There is a checkerd "got focus" border around one of the buttons. I want both buttons to not have the checker border.

    Thank you,
    C:\DOS
    C:\DOS\RUN
    RUN\DOS\RUN

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Remove the checker border from command button

    I don't know of a way to turn off the focus rect of a VB command button, but if this is just for the start up apperance you could add say an option control to the form, move it out of view and set focus on it.
    Code:
    Private Sub Form_Load()
    
        Option1.Top = (-Option1.Height)
        Me.Show
        DoEvents
        Option1.SetFocus
    
    End Sub

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Remove the checker border from command button

    Why do you even have to have the code for the option control? If you add Option1, then Command1 on top of the Option control and then add Command2 and then run the program neither Command button has the dotted focus border.

  4. #4
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Remove the checker border from command button

    Quote Originally Posted by jmsrickland
    Why do you even have to have the code for the option control? If you add Option1, then Command1 on top of the Option control and then add Command2 and then run the program neither Command button has the dotted focus border.
    True, guess I'm just used to working with a lot of transparent controls and got into that habit.

  5. #5
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Remove the checker border from command button

    The other option is to use two Image Controls instead of Commanbutton. I have used this for one of my application and the user like it very much...

    I have atttached an example

    Edit:

    Sorry forgot to add images... updated that
    Attached Files Attached Files
    Last edited by Siddharth Rout; Feb 28th, 2009 at 02:36 AM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  6. #6

    Thread Starter
    Addicted Member scottlafoy's Avatar
    Join Date
    Feb 2009
    Location
    Calgary Alberta, Canada
    Posts
    148

    Re: Remove the checker border from command button

    Thanks every one, great ideas. I ended up hiding another command button and putting focus on that.

    Koolsid, I never thought of going that way. That is pretty neat. Where did you find those icons?
    C:\DOS
    C:\DOS\RUN
    RUN\DOS\RUN

  7. #7
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Remove the checker border from command button

    I created them in Bitmap

    So if your query is solved, then do remmebr to mark this thread resolved
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  8. #8
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Remove the checker border from command button

    Quote Originally Posted by jmsrickland
    ...(regarding Edgemeal's post #2) ... Why do you even have to have the code for the option control? If you add Option1, then Command1 on top of the Option control and then add Command2 and then run the program neither Command button has the dotted focus border.
    It is probably better to move it out of the way as EdgeMeal described. This way should the command button be moved, resized or hidden with/without the user knowing it (think of some resizing utils that can resize all controls), the option button won't be seen. One cannot make it invisible either because you cannot set focus to an invisible control.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  9. #9
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] Remove the checker border from command button

    Well, OK, wheather it's under the button or off the Form it's the same thing. All that has to be done is that the Option control be the first control made (move it off the Form then if that makes it better). That was my point, not wheather it is under a button, off the Form or whatever.
    Last edited by jmsrickland; Feb 28th, 2009 at 11:33 PM.

  10. #10
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: [RESOLVED] Remove the checker border from command button

    The only challenge I see here in case of using an option button or as a matter of fact any control which is hidden behind other control or anywhere in the form is that if the users presses tab to cycle between controls, then at one point the user might be perplexed that the focus disappears... just a thought...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  11. #11
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] Remove the checker border from command button

    Not if the two Command buttons have their TabStops set to False or have all three controls with a False TabStop; in either case that will stop the focus until the user presses a button. I really got the impression that the OP just wanted the two buttons not to have the focus at startup but even so it doesn't matter if that is not exactly what he wanted.
    Last edited by jmsrickland; Feb 28th, 2009 at 11:35 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width