forked from yaunqiying/EasyCharts
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathForm_Camera.cs
82 lines (74 loc) · 2.64 KB
/
Form_Camera.cs
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
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CSharpWin_JD.CaptureImage;
namespace ExcelAddIn_Graphics
{
public partial class Form_Camera : Form
{
public Form_Camera()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
CaptureImageTool capture = new CaptureImageTool();
//capture.SelectCursor = new Cursor(Properties.Resources.Arrow_M.Handle);
if (capture.ShowDialog() == DialogResult.OK)
{
Image image = capture.Image;
pictureBox1.Width = image.Width;
pictureBox1.Height = image.Height;
pictureBox1.Image = image;
}
}
private void Form_Camer_Activated(object sender, EventArgs e)
{
HotKey.RegisterHotKey(Handle, 102, HotKey.KeyModifiers.Alt | HotKey.KeyModifiers.Ctrl, Keys.S);
}
private void Form_Camer_Leave(object sender, EventArgs e)
{
HotKey.UnregisterHotKey(Handle, 102);
}
///
/// 监视Windows消息
/// 重载WndProc方法,用于实现热键响应
///
///
protected override void WndProc(ref Message m)
{
const int WM_HOTKEY = 0x0312;//如果m.Msg的值为0x0312那么表示用户按下了热键
//按快捷键
switch (m.Msg)
{
case WM_HOTKEY:
switch (m.WParam.ToInt32())
{
case 100: //按下的是Shift+S
//此处填写快捷键响应代码
break;
case 101: //按下的是Ctrl+B
//此处填写快捷键响应代码
break;
case 102: //按下的是Ctrl+Alt+S
CaptureImageTool capture = new CaptureImageTool();
if (capture.ShowDialog() == DialogResult.OK)
{
Image image = capture.Image;
pictureBox1.Width = image.Width;
pictureBox1.Height = image.Height;
pictureBox1.Image = image;
}
break;
}
break;
}
base.WndProc(ref m);
}
}
}