这篇文章主要介绍了C# winForm实现的气泡提示窗口功能,涉及C# winForm窗口属性与设置相关操作技巧,需要的朋友可以参考下
这篇文章主要介绍了C# winForm实现的气泡提示窗口功能,涉及C# winForm窗口属性与设置相关操作技巧,需要的朋友可以参考下
这篇文章主要介绍了C# winForm实现的气泡提示窗口功能,涉及C# winForm窗口属性与设置相关操作技巧,需要的朋友可以参考下
本文实例讲述了c# winform实现的气泡提示窗口功能。分享给大家供大家参考,具体如下:
|
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
|
using system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.text;using system.windows.forms;namespace windowsformsapplication60{ public partial class form1 : form { private button btnshow = null; private button btnclose = null; private notifyicon notifyicon1 = null; public form1() { initializecomponent(); this.load+=new eventhandler(form1_load); } private void form1_load(object sender, eventargs e) { btnshow = new button();//显示气泡提示窗口 btnshow.text = "show"; btnshow.click += new eventhandler(btnshow_click); btnshow.location = new point(10, 10); this.controls.add(btnshow); btnclose = new button();//影藏气泡提示窗口 btnclose.text = "close"; btnclose.click += new eventhandler(btnclose_click); btnclose.location = new point(10 + btnshow.width + 10, 10); this.controls.add(btnclose); notifyicon1 = new notifyicon(); notifyicon1.mousemove += new mouseeventhandler(notifyicon1_mousemove); notifyicon1.icon = global::windowsformsapplication60.properties.resources.lintway; } /// <summary> /// 鼠标移过显示时间 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void notifyicon1_mousemove(object sender, mouseeventargs e) { this.notifyicon1.showballoontip(1000, "当前时间:", datetime.now.tolocaltime().tostring(), tooltipicon.info);//显示气泡提示 } /// <summary> /// 影藏时间 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnclose_click(object sender, eventargs e) { this.notifyicon1.visible = false;//设置提示控件不可见 } /// <summary> /// 显示时间 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnshow_click(object sender, eventargs e) { this.notifyicon1.visible = true;//设置提示控件可见 this.notifyicon1.showballoontip(1000, "当前时间:", datetime.now.tolocaltime().tostring(), tooltipicon.info);//显示气泡提示 } }} |
希望本文所述对大家c#程序设计有所帮助。
原文链接:https://blog.csdn.net/chadcao/article/details/7183781
发表评论