当前位置:网站首页>C# 使用ToolTip控件实现气泡提示
C# 使用ToolTip控件实现气泡提示
2022-07-15 12:36:00 【InfoQ】
前言:
每日一遍,欢乐一整天

1.创建窗体文件

2.设计界面

3.配置toolTip控件

Active属性:确定工具指示是否是活动的。只有在激活工具提示后才会显示提示信息
AutiPopDealy属性:确定当指针在工具提示区域内保持静止时,工具提示窗口保持可见的时间长度
InitialDealy属性:确定在提示窗口显示之前,指针必须在工具提示区域内保持静止时间的长度
IsBallon属性:这个属性指示控件是否以气球的形式出现。默认为false
OnwerDraw属性:这个属性指示系统是否可以绘制子项、如果是那则是为False
ReShowDealy属性:确定当一个指针从从一个工具提示区域移动到另一个工具区域提示时,后面的工具提示窗口将在多长时间内显示
4. 对需要设置提示的地方设置提示

4.1 简单效果演示
4.1.1 默认提示样式

4.1.2 使用气泡样式

4.2 对提示设置图标和标题


4.3 使用代码对图标和标题动态设置

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 实现提示操作
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void toolTip1_Popup(object sender, PopupEventArgs e)
{
ToolTip tool = (ToolTip)sender;
if(e.AssociatedControl.Name == "textBox1")//e代表我们要触发的事件,我们是在textBox1触发
{
tool.ToolTipTitle = "提示信息";//修改标题
tool.ToolTipIcon = ToolTipIcon.Info;//修改图标
}
else
{
tool.ToolTipTitle = "警告信息";
tool.ToolTipIcon = ToolTipIcon.Warning;
}
}
}
}
整体效果展示

总结

边栏推荐
- 51nod 1278 separated circles
- 二叉树上的相等子树
- Play about the workplace: Senior HR tells you what characteristics strong people in the workplace have
- 分布式数据库技术前瞻
- Clickpaas Ma Jun: model driven low code platform practice
- MySQL (III) router, MHA high availability
- 线程-interrupt方法详解
- The US Treasury Department approved the transaction of chemical fertilizers and agricultural products with Russia
- Comparison of xssfworkbook, sxssfworkbook and easyexcel reading Excel files
- H5 implementation generates urlscheme and jumps from H5 to applet
猜你喜欢

Unit MySQL appears in MySQL Solution of service could not be found

腾讯大咖分享 | 腾讯Alluxio(DOP)在金融场景的落地与优化实践

Robotframework advanced (I) integrated pychart and UI automation use case writing

Robotframework advanced (III) integrated Jenkins operation automation use case
![[MySQL] multi table query](/img/9a/21b8996470203d7dfbb162ae0d9276.png)
[MySQL] multi table query

After downloading pyqt5, I found that the designer could not be found Exe problem solution

GRE, mGRE experiment

什么是主动元数据?为什么Gartner预测它是元数据管理的新方向

Index in MySQL

麦肯锡:未来十年,十大顶尖技术趋势将影响投资和研究方向
随机推荐
Hcip notes (4)
Two years ago, how were the leading players and blue chips in defi?
Index in MySQL
"Xiaobaizui" white yam is the characteristic agricultural product of which county? Ant new village July 15 answer
Lesson 2 WiFi experiment of hi3861 -api-1
H5 implementation generates urlscheme and jumps from H5 to applet
Efficient development of harmonyos course applications based on ETS
Slow SQL analysis and optimization
想成为精英级开发者?请逼自己养成这10个习惯
What is the difference between Web3 and outbreak?
String splicing
Who is the "horse race enclosure" of the meta cosmic explosion?
基于neo4j的知识图谱构建及Py2neo的使用总结
在线办公,如何让协同更高效?
ModuleNotFoundError: No module named ‘fake_ useragent‘
Introduction to risk assessment
【MySQL】表的内外链接
Analyze the meaning of "collaboration" in collaborative office, and how can digital office easily "solve the problem"?
LNMP architecture PHP installation
Learning summary Note 6 (Gerui titant software - Jiuye practical training)