首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

子线程控制NotifyIcon解决办法

2012-01-09 
子线程控制NotifyIcon跨线程访问控件需要托管,我一般是使用Invoke来完成目的。但现在我要在子线程中让托盘

子线程控制NotifyIcon
跨线程访问控件需要托管,我一般是使用Invoke来完成目的。
但现在我要在子线程中让托盘的NotifyIcon显示气球,而NotifyIcon却又没有Invoke
我该怎么实现呢?

[解决办法]
用notifyicon的宿主控件的invoke,例如
private delegate sub nicInvoke(state as object)

private sub SetNotifyIcon(state as object)
 if me.invokerequired then
me.invoke(new nicInvoke(addressof setnotifyicon),state)
 else
'此处加入notifyicon控制代码
 end if
end private

使用时,直接调用setnotifyicon

热点排行