Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Problem in button (.Net 2008, Framework 3.5).

Problem in button (.Net 2008, Framework 3.5).

Scheduled Pinned Locked Moved Windows Forms
helpcsharpquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    priyamtheone
    wrote on last edited by
    #1

    When a button is focused by pressing Tab key, a rectangle appears on it. Even if the button's TabStop property is set to false, when the button is clicked with mouse the rectangle appears. Is it possible to stop the rectangle from appearing? Please help. Regards.

    D L 2 Replies Last reply
    0
    • P priyamtheone

      When a button is focused by pressing Tab key, a rectangle appears on it. Even if the button's TabStop property is set to false, when the button is clicked with mouse the rectangle appears. Is it possible to stop the rectangle from appearing? Please help. Regards.

      D Offline
      D Offline
      Dr Walt Fair PE
      wrote on last edited by
      #2

      What exactly are you trying to do? The TabStop property only determines whether the control can be selected using the Tab key. Obviously using the mouse by passes that, so it is behaving as expected. Do you perhaps want to disable the control (Enabled = false;) or hide it (Visible = false;) or just not provide user feedback that it's selected?

      CQ de W5ALT

      Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

      1 Reply Last reply
      0
      • P priyamtheone

        When a button is focused by pressing Tab key, a rectangle appears on it. Even if the button's TabStop property is set to false, when the button is clicked with mouse the rectangle appears. Is it possible to stop the rectangle from appearing? Please help. Regards.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Owner-drawing? ..or the ImageButton from the VB PowerPack[^] - it has a ShowFocusRect property :) By hiding the focus, the user won't know what control will be reacting to key-presses. It'd make a very confusing user-experience.

        I are Troll :suss:

        P 1 Reply Last reply
        0
        • L Lost User

          Owner-drawing? ..or the ImageButton from the VB PowerPack[^] - it has a ShowFocusRect property :) By hiding the focus, the user won't know what control will be reacting to key-presses. It'd make a very confusing user-experience.

          I are Troll :suss:

          P Offline
          P Offline
          priyamtheone
          wrote on last edited by
          #4

          By inheriting the standard button class here's another solution I came up to:

          class CustomButton : System.Windows.Forms.Button
          {
          private bool _DisplayFocusCues = true;
          protected override bool ShowFocusCues
          {
          get
          {
          return _DisplayFocusCues;
          }
          }

             public bool DisplayFocusCues
             {
                 get
                 {
                     return \_DisplayFocusCues;
                 }
                 set
                 {
                     \_DisplayFocusCues = value;
                 }
             }
          

          }

          Using this class you can set DisplayFocusCues at design time too.

          L R R 3 Replies Last reply
          0
          • P priyamtheone

            By inheriting the standard button class here's another solution I came up to:

            class CustomButton : System.Windows.Forms.Button
            {
            private bool _DisplayFocusCues = true;
            protected override bool ShowFocusCues
            {
            get
            {
            return _DisplayFocusCues;
            }
            }

               public bool DisplayFocusCues
               {
                   get
                   {
                       return \_DisplayFocusCues;
                   }
                   set
                   {
                       \_DisplayFocusCues = value;
                   }
               }
            

            }

            Using this class you can set DisplayFocusCues at design time too.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Cool, didn't know that one yet. Would be a neat trick[^] to share :)

            I are Troll :suss:

            1 Reply Last reply
            0
            • P priyamtheone

              By inheriting the standard button class here's another solution I came up to:

              class CustomButton : System.Windows.Forms.Button
              {
              private bool _DisplayFocusCues = true;
              protected override bool ShowFocusCues
              {
              get
              {
              return _DisplayFocusCues;
              }
              }

                 public bool DisplayFocusCues
                 {
                     get
                     {
                         return \_DisplayFocusCues;
                     }
                     set
                     {
                         \_DisplayFocusCues = value;
                     }
                 }
              

              }

              Using this class you can set DisplayFocusCues at design time too.

              R Offline
              R Offline
              Ravi Bhavnani
              wrote on last edited by
              #6

              Nice! /ravi

              My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

              1 Reply Last reply
              0
              • P priyamtheone

                By inheriting the standard button class here's another solution I came up to:

                class CustomButton : System.Windows.Forms.Button
                {
                private bool _DisplayFocusCues = true;
                protected override bool ShowFocusCues
                {
                get
                {
                return _DisplayFocusCues;
                }
                }

                   public bool DisplayFocusCues
                   {
                       get
                       {
                           return \_DisplayFocusCues;
                       }
                       set
                       {
                           \_DisplayFocusCues = value;
                       }
                   }
                

                }

                Using this class you can set DisplayFocusCues at design time too.

                R Offline
                R Offline
                RaviRanjanKr
                wrote on last edited by
                #7

                yup! that's one of the perfect way to set DisplayFocus at design time :)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups