zoukankan
html css js c++ java
winform中的Balloon提示
1.扩展类库
namespace
DvsCC
{
using
System;
using
System.Drawing;
using
System.Reflection;
using
System.Runtime.InteropServices;
using
System.Windows.Forms;
/**/
///
<summary>
///
Summary description for NativeMethods.
///
</summary>
public
class
NativeMethods
{
private
const
long
WS_POPUP
=
0x80000000
;
private
const
long
TTS_BALLOON
=
0x40
;
private
const
long
TTS_NOFADE
=
0x20
;
private
const
int
GWL_STYLE
=
-
16
;
private
const
int
WM_USER
=
0x0400
;
private
const
int
TTM_SETTIPBKCOLOR
=
WM_USER
+
19
;
private
NativeMethods()
{}
public
static
void
SetBalloonStyle ( ToolTip toolTip )
{
NativeWindow window
=
GetNativeWindow ( toolTip );
NativeMethods.SetWindowLong ( window.Handle, GWL_STYLE , WS_POPUP
|
TTS_BALLOON
|
TTS_NOFADE );
}
public
static
void
SetBackColor ( ToolTip toolTip, Color color )
{
int
backColor
=
ColorTranslator.ToWin32( color );
NativeWindow window
=
GetNativeWindow ( toolTip );
//
setting back color
SendMessage( window.Handle, TTM_SETTIPBKCOLOR, backColor,
0
);
}
private
static
NativeWindow GetNativeWindow ( ToolTip toolTip )
{
FieldInfo windowField
=
toolTip.GetType().GetField(
"
window
"
, BindingFlags.NonPublic
|
BindingFlags.Static
|
BindingFlags.Instance );
NativeWindow window
=
(NativeWindow)windowField.GetValue ( toolTip );
if
( window.Handle
==
IntPtr.Zero )
throw
new
ArgumentNullException (
"
window handle is not crated.
"
);
return
window;
}
[DllImport(
"
user32.dll
"
)]
private
static
extern
long
SetWindowLong(IntPtr hwnd,
int
index,
long
val);
[DllImport(
"
user32.dll
"
)]
private
static
extern
int
SendMessage( IntPtr hwnd,
int
msg,
int
wParam,
int
lParam);
}
}
2.使用方法
NativeMethods.SetBalloonStyle ( toolTip1 );
作者:
jillzhang
出处:
http://jillzhang.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
查看全文
相关阅读:
前端html
后端Django和前段vue.js结合 快速搭建框架
机器学习——matplotlib
机器学习——pandas
机器学习——概念
机器学习——numpy
django创建项目流程
django2.0中配置文件的配置
django项目的大致流程
django中的数据库
原文地址:https://www.cnblogs.com/jillzhang/p/664657.html
最新文章
笔记:MAC OS X下配置PHP开发、调试环境
笔记:PHP查询mysql数据后中文字符乱码
Eclipse下搭建Hadoop2.4.0开发环境
安装hadoop2.4.0遇到的问题
二、Ubuntu14.04下安装Hadoop2.4.0 (伪分布模式)
一、Ubuntu14.04下安装Hadoop2.4.0 (单机模式)
伪分布模式下执行wordcount实例时报错解决办法
Hadoop的datanode无法启动
Windows平台下安装Hadoop
这世上倒底有没有神仙——说“Excel不是数据库,是不是犯了白马非马论的错误??
热门文章
获取SQL Server的版本信息
Win2003不显示移动硬盘、U盘解决方法
django笔记
scrapy
vue的过滤器
vue.js 监听属性的学习 千米/米/ 时 /分/ 秒的转换
练习小游戏 简化版贪吃蛇
前端网页匹配手机号
jquery_ajax的学习
前端javascript
Copyright © 2011-2022 走看看