zoukankan
html css js c++ java
带有ToolTip的ListBox
Code
1
Private
Sub ListBox1_MouseMove()
Sub
ListBox1_MouseMove(
ByVal
sender
As
Object
,
ByVal
e
As
System.Windows.Forms.MouseEventArgs)
Handles
ListBox1.MouseMove
2
Dim
MousePositionInClientCoords
As
Point
=
Me
.ListBox1.PointToClient(
Me
.MousePosition)
3
Dim
indexUnderTheMouse
As
Integer
=
Me
.ListBox1.IndexFromPoint(MousePositionInClientCoords)
4
If
indexUnderTheMouse
>
-
1
Then
5
Dim
s
As
String
=
Me
.ListBox1.Items(indexUnderTheMouse).ToString
6
Dim
g
As
Graphics
=
Me
.ListBox1.CreateGraphics
7
If
g.MeasureString(s,
Me
.ListBox1.Font).Width
>
Me
.ListBox1.ClientRectangle.Width
Then
8
Me
.ToolTip1.SetToolTip(
Me
.ListBox1, s)
9
Else
10
Me
.ToolTip1.SetToolTip(
Me
.ListBox1,
""
)
11
End
If
12
g.Dispose()
13
End
If
14
End Sub
15
或者
Code
1
Private
Sub ListBox1_MouseMove()
Sub
ListBox1_MouseMove(
ByVal
sender
As
Object
,
ByVal
e
As
System.Windows.Forms.MouseEventArgs)
Handles
ListBox1.MouseMove
2
Dim
MousePositionInClientCoords
As
Point
=
New
Point(e.X, e.Y)
3
Dim
indexUnderTheMouse
As
Integer
=
Me
.ListBox1.IndexFromPoint(MousePositionInClientCoords)
4
If
indexUnderTheMouse
>
-
1
Then
5
Dim
s
As
String
=
Me
.ListBox1.Items(indexUnderTheMouse).ToString
6
Dim
g
As
Graphics
=
Me
.ListBox1.CreateGraphics
7
If
g.MeasureString(s,
Me
.ListBox1.Font).Width
>
Me
.ListBox1.ClientRectangle.Width
Then
8
Me
.ToolTip1.SetToolTip(
Me
.ListBox1, s)
9
Else
10
Me
.ToolTip1.SetToolTip(
Me
.ListBox1,
""
)
11
End
If
12
g.Dispose()
13
End
If
14
End Sub
查看全文
相关阅读:
端口以及服务常用cmd
异步,同步,阻塞,非阻塞,并行,并发,
mysql启动不起来
安装nagios出现的错误
Linux内核优化
mysql使用常见问题
mysql日志
mysql数据库使用脚本实现分库备份过程
mysqladmin常用用法
mysql授权
原文地址:https://www.cnblogs.com/TextEditor/p/1524965.html
最新文章
对InvokeAction简略分析了解验证失败为什么Action还会继续执行
对非线程安全类List<T>的一些总结
两个实用的工具推荐:ResxManager和ValueInjecter
How and Where Concurrent Asynchronous I/O with ASP.NET Web API 对异步编程分析的非常的好
Understanding ASP.NET MVC Filters and Attributes
Spring框架源码中比较好的方法
Json工具类
《如何快速搭建一个微服务架构》---总结
Java源码分析之-Serializable接口
Java源码分析之StringBuffer---A thread-safe, mutable sequence of characters.
热门文章
《数据结构:从应用到实现 java版》---第六天
《数据结构:从应用到实现-Java版本》---第五天
《数据结构:从应用到实现--java版》---第三天
Hibernate与Mybatis的区别
SQL Server事务回滚对自增键的影响
SQL Server乱码处理(ASCII)
C# 属性与字段
C# ADO.NET+反射读取数据库并转换为List
SQL server 查询语句优先级-摘抄
LogNet4
Copyright © 2011-2022 走看看