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
查看全文
相关阅读:
综合疑问
MySQL查询优化器工作原理解析
mysql配置文件参数详解
MySQL查看、创建和删除索引的方法
删除maven仓库中的lastUpdate文件
加密算法的概述
.bat脚本基本命令语法
spring-core中@Order和Ordered接口的源码解析说明
spring-context中@Profile注解的源码解析说明
spring-context中@Bean的源码解析说明和它与其他注解的结合使用
原文地址:https://www.cnblogs.com/TextEditor/p/1524965.html
最新文章
ftp之filezilla使用记录
代理ip知识
block、inline、inline-block区别以及标签嵌套
Python零散知识点记录
Python发送邮件
Python不同包之间调用注意事项
idea部署tomcat-404错误
异常Throwable
【SpringAop】【统一日志处理】注解方式理解以及使用
接口没添加@responseBody注解
热门文章
maven项目springmvc导包失败-JsonProcessingException
【jdbcTemplate】baseDao书写规范
工具类Utils的单元测试方式
代码声明定义建议顺序
idea窗口下方滚动条不明显设置
idea单元测试左侧装订线中的颜色指示器设置
MySql 小表驱动大表
mysql语句的书写顺序和执行顺序
mysql-存储过程--demo
MYSQL事务-隔离级别
Copyright © 2011-2022 走看看