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. C#
  4. Preventing Form Focus

Preventing Form Focus

Scheduled Pinned Locked Moved C#
csharphelpquestion
5 Posts 2 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.
  • K Offline
    K Offline
    kmuthuk
    wrote on last edited by
    #1

    Hi All My application (C#, Framework 1.1) running in the background. I am displaying a form in every five minutes. This form has only a hyperlink control. To show myForm I am using myForm.ShowDialog(); When this form is displayed, it grabs the focus, and I loose the focus if I am working in another application, say, MS-Word. My form has the following properties set. myForm.TopMost = false; myForm.FormBorderStyle = FormBorderStyle.None; How can prevent this from happening? Can anybody help me on this? Thanks Muthu.

    L 1 Reply Last reply
    0
    • K kmuthuk

      Hi All My application (C#, Framework 1.1) running in the background. I am displaying a form in every five minutes. This form has only a hyperlink control. To show myForm I am using myForm.ShowDialog(); When this form is displayed, it grabs the focus, and I loose the focus if I am working in another application, say, MS-Word. My form has the following properties set. myForm.TopMost = false; myForm.FormBorderStyle = FormBorderStyle.None; How can prevent this from happening? Can anybody help me on this? Thanks Muthu.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      have seen this before... http://www.codeproject.com/script/comments/forums.asp?msg=1821173&forumid=1649&XtraIDs=1649&searchkw=topmost&sd=7+Oct+2006&ed=5+Jan+2007&stype=1#xx1821173xx[^] :)

      Luc Pattyn

      K 1 Reply Last reply
      0
      • L Luc Pattyn

        have seen this before... http://www.codeproject.com/script/comments/forums.asp?msg=1821173&forumid=1649&XtraIDs=1649&searchkw=topmost&sd=7+Oct+2006&ed=5+Jan+2007&stype=1#xx1821173xx[^] :)

        Luc Pattyn

        K Offline
        K Offline
        kmuthuk
        wrote on last edited by
        #3

        Hi, My issue is I want to show the form..I don't want to hide it. When I am showing that form..it should not get any focus. The work being done in other applications should not be interrupted. Thanks Muthu.

        L 1 Reply Last reply
        0
        • K kmuthuk

          Hi, My issue is I want to show the form..I don't want to hide it. When I am showing that form..it should not get any focus. The work being done in other applications should not be interrupted. Thanks Muthu.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Why are you using ShowDialog() instead of Show() ? ShowDialog() makes the form the top window for that application (as with modal dialogs, the onces you can not ignore inside an application), whereas Show() is used normally for forms and for modeless dialogs (the ones you can leave open but still allow you to operate other windows). :)

          Luc Pattyn

          K 1 Reply Last reply
          0
          • L Luc Pattyn

            Why are you using ShowDialog() instead of Show() ? ShowDialog() makes the form the top window for that application (as with modal dialogs, the onces you can not ignore inside an application), whereas Show() is used normally for forms and for modeless dialogs (the ones you can leave open but still allow you to operate other windows). :)

            Luc Pattyn

            K Offline
            K Offline
            kmuthuk
            wrote on last edited by
            #5

            Because I am calling ShowDialog() in a Thread. If I use Show(), it gives a weird look, and controls in the second form not diplayed and grayed. Thanks Muthu.

            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