1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

C#.NETでウィンドウを最前面固定に

Last updated at Posted at 2023-02-24

やり方

image.png

image.png

サンプルコード
using System.Windows.Forms;

namespace Saizennmendayo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            this.TopMost = true;

        }
    }
}

image.png

最前面に設定したウィンドウが複数開かれた場合

最後に開いたウィンドウが最前面になる。

例えば、下記は…

  1. 最前面に設定したウィンドウを開いた。(赤枠)
  2. 最前面に設定したウィンドウを開いた。(青枠)
  3. ForeFoxをクリックした。

という状態。
image.png

青枠の方が後に開いたから、それが最前面になる。
赤枠の方も最前面として開いてはいたので、ForeFoxより前になる。

バージョン

Windows 10 Pro 22H2 OSビルド 19045.2604
Microsoft .NET Framework Version 4.8.04084

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?