forked from 0000duck/VisionEdit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCButton.cs
More file actions
67 lines (64 loc) · 1.77 KB
/
CButton.cs
File metadata and controls
67 lines (64 loc) · 1.77 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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Controls.Properties;
namespace Controls
{
public delegate void DClicked();
public partial class CButton : UserControl
{
public CButton()
{
InitializeComponent();
btn_button.Text = TextStr;
}
/// <summary>
/// 点击事件
/// </summary>
public event DClicked Clicked;
/// <summary>
/// 文本
/// </summary>
private string _textStr = "Button";
public string TextStr
{
get { return _textStr; }
set
{
_textStr = value;
btn_button.Text = value;
}
}
private void btn_button_MouseEnter(object sender, EventArgs e)
{
btn_button.BackgroundImage = Resources.ButtonEnter;
Application.DoEvents();
}
private void btn_button_MouseDown(object sender, MouseEventArgs e)
{
btn_button.BackgroundImage = Resources.ButtonDown;
Application.DoEvents();
}
private void btn_button_MouseLeave(object sender, EventArgs e)
{
btn_button.BackgroundImage = Resources.ButtonUp;
Application.DoEvents();
}
private void btn_button_MouseUp(object sender, MouseEventArgs e)
{
btn_button.BackgroundImage = Resources.ButtonUp;
Application.DoEvents();
}
private void btn_button_Click(object sender, EventArgs e)
{
if (Clicked != null)
Clicked();
}
}
}