Announcement

Collapse
No announcement yet.

TopMost aber nicht aktiv

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • TopMost aber nicht aktiv

    Hallo,
    Habe nochmal ein kleines Problem, zu dem ich bisher keine Lösung gefunden habe.

    Ich habe ein kleines Programm geschrieben, welches Fehler per PopUp in der Taskleiste ausspuckt.

    Nun will ich, dass diese PopUpForm ywar topMost ist, aber nicht automatisch aktiv ist, wenn sie kommt, denn es ist schon nervig, wenn man gerade etwas in Word tippen will und aufeinmal das PopUp den Focus hat.

    Hat jemand eine Idee wie ich das simpel lösen kann?
    Danke schon mal im voraus

  • #2
    Das geht wahrscheinlich nur wenn du die Form über die WinAPI anzeigst.

    Guck dir mal die ShowWindow API auf pinvoke.net an.
    Eins der Codebeispiele(Topmost Window Without Focus) dreht sich genau um dein Problem.

    Comment


    • #3
      Hallo,

      du kannst dann der aktuellen Form den Focus wieder zuweisen:
      [highlight=c#]
      private void button1_Click(object sender, EventArgs e)
      {
      Form2 frm = new Form2();
      frm.TopMost = true;
      frm.Show();
      this.Select();
      }
      [/highlight]

      Vielleichts gehts auch anders.

      mfG Gü
      "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

      Comment


      • #4
        Vielleichts gehts auch anders.
        Danke Ralf.

        mfG Gü
        "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

        Comment


        • #5
          Originally posted by Ralf Jansen View Post
          Das geht wahrscheinlich nur wenn du die Form über die WinAPI anzeigst.

          Guck dir mal die ShowWindow API auf pinvoke.net an.
          Eins der Codebeispiele(Topmost Window Without Focus) dreht sich genau um dein Problem.


          Optimal...hat funktioniert.
          Danke dir

          Comment

          Working...
          X