LoginSignup
0
0

More than 5 years have passed since last update.

ポインタを左端から右端に移動する

Posted at

4displays

4台ディスプレイをつないで使っている。4K×2台と、あとは2560×1440(3K?)と1920×1080(2K)。
画面が広くて作業性は高い。
やっと画面の広さが、本物の机に近づいてきた気がしている。

Pointer Location

困っているのが、ポインタを左端から右端に移動する作業。
左端のディスプレイと、右端のディスプレイには、基本的に情報を得るだけ(ビューオンリー)のウィンドウを配置しているが、基本的にWindowsはウィンドウの位置を覚えないので、操作が必要なこともわりとある。

Watch PointerLocation

そこで、自作常駐ソフトで、ポインタの位置を監視し、ポインタを右端から左端に飛ばすことにした。前に、複数のPC(Windows/Mac)でポインタを連携できるSynergeyというのを使ったことがあるが、それみたいにするわけだ。

Coding

具体的には、x=5279でx=-3240にすればよい。
下記コードでできた。

using System.Drawing;
using System.Windows.Forms;

namespace reportDisplays
{
    public partial class Form1 : Form
    {
        Point PastPoint = new Point();

        private void LeftRightJump(Point pointerlocation)
        {
            if (pointerlocation.X == 5279 && PastPoint.X < 5279)
            {
                pointerlocation.X = -3240;
                Cursor.Position = pointerlocation;
            }
            else if (pointerlocation.X == -3240 && -3240 < PastPoint.X)
            {
                pointerlocation.X = 5279;
                Cursor.Position = pointerlocation;
            }

            PastPoint = pointerlocation;
        }
    }
}
0
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
0
0