FrmScreenPoint.cs
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TSA_V
{
public partial class FrmScreenPoint : Form
{
public FrmScreenPoint()
{
InitializeComponent();
}
public int ScreenIndex = 1;
private void FrmScreenPoint_Load(object sender, EventArgs e)
{
this.Text = "显示测试_" + ScreenIndex;
Screen[] sc = Screen.AllScreens;
this.StartPosition = FormStartPosition.Manual;
if (sc.Count() > ScreenIndex)
{
Screen screen = sc[ScreenIndex];
this.Location = new Point(screen.Bounds.Left, screen.Bounds.Top);
this.WindowState = FormWindowState.Normal;
this.WindowState = FormWindowState.Maximized;
//string text ="名称:"+ screen.DeviceName+"\r\n";
//text += "X:" + screen.Bounds.X + "\r\n";
//text += "Y:" + screen.Bounds.Y+ "\r\n";
//text += "Width:" + screen.Bounds.Width+ "\r\n";
//text += "Heigh:" + screen.Bounds.Height+ "\r\n";
//text += "是否主显示器:"+screen.Primary.ToString() + "\r\n";
//lblInfo.Text = text;
}
else
{
this.Visible = false;
}
}
public void DrawPoint(int x,int y,int size=20)
{
Graphics g = panel1.CreateGraphics();
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);//画刷
//int x = index % 20 * 60;
//int y = index / 20 * 60;
g.FillEllipse(myBrush, new Rectangle(x, y, size, size));//画实心椭圆
g.Dispose();
}
public void ClearPoint( )
{
Graphics g = this.panel1.CreateGraphics();
g.Clear(Color.White);
g.Dispose();//释放资源
this.TransparencyKey = this.panel1.BackColor;
}
}
}