子线程控制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