-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinputTest.cs
More file actions
35 lines (29 loc) · 911 Bytes
/
inputTest.cs
File metadata and controls
35 lines (29 loc) · 911 Bytes
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
using System;
using System.Windows.Forms;
using System.Drawing;
namespace PenData
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Create a new pen input device.
var penDevice = new PenInputDevice();
// Subscribe to the pen down event.
penDevice.PenDown += new PenInputDeviceEventHandler(penDevice_PenDown);
// Start the pen input device.
penDevice.Start();
}
private void penDevice_PenDown(object sender, PenInputDeviceEventArgs e)
{
// Get the pen position.
Point position = e.Position;
// Draw a circle at the pen position.
Graphics.FromHwnd(this.Handle).DrawCircle(Pens.Black, position, 10);
}
}
}