-
Notifications
You must be signed in to change notification settings - Fork 3
/
ViewportPicbox.cs
54 lines (48 loc) · 1.03 KB
/
ViewportPicbox.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
/*
* Created by SharpDevelop.
* User: NCDyson
* Date: 11/4/2017
* Time: 4:45 AM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace StudioCCS
{
using System;
using System.Drawing;
using System.Windows.Forms;
class ViewportPicbox : PictureBox
{
public ViewportPicbox()
{
this.SetStyle(ControlStyles.Selectable, true);
this.TabStop = true;
}
protected override void OnMouseDown(MouseEventArgs e)
{
this.Focus();
base.OnMouseDown(e);
}
protected override void OnEnter(EventArgs e)
{
this.Invalidate();
base.OnEnter(e);
}
protected override void OnLeave(EventArgs e)
{
this.Invalidate();
base.OnLeave(e);
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
if (this.Focused)
{
var rc = this.ClientRectangle;
rc.Inflate(-2, -2);
ControlPaint.DrawFocusRectangle(pe.Graphics, rc);
}
}
}
}