窗口激活导致控件消失 [英] Window Activiation Causes Controls to Disappear

查看:63
本文介绍了窗口激活导致控件消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个小小的应用程序运行,并且当最小化时,它会将

本身抛入系统托盘,直到用户双击系统托架

图标。为了实现第一部分我有这个:


Private Sub frmMain_Resize(ByVal sender As Object,ByVal e As _

System.EventArgs)处理MyBase.Resize

如果Me.WindowState = FormWindowState.Minimized那么

Me.Visible = False

Me.ShowInTaskbar = False

结束如果

结束子


...我希望这是正确的,它似乎确实有效。


要双击我所拥有的图标再次显示窗口:


Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object,ByVal e

As System。 EventArgs)处理NotifyIcon1.DoubleClick


Me.Visible = True

Me.ShowInTaskbar = True

Me.Activate()


如果Me.WindowState = FormWindowState.Minimized那么

Me.WindowState = FormWindowState.Normal

结束如果
< br $>
End Sub


但是,面板和面板上的2个Web浏览器控件是

hidd恩,永远不再出现..


我在做什么(或不做什么!)?


-

- Mitchell


I have a tiny little application that runs, and when minimized it throws
itself into the systray until the user double clicks on the systray
icon. To accomplish that first part I have this :

Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles MyBase.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.Visible = False
Me.ShowInTaskbar = False
End If
End Sub

... I hope that is correct, it does seem to work.

To show the window again on double click of the icon I have :

Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e
As System.EventArgs) Handles NotifyIcon1.DoubleClick

Me.Visible = True
Me.ShowInTaskbar = True
Me.Activate()

If Me.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Normal
End If

End Sub

However, the panel and the 2 web browser controls on the panel are
hidden and never show up again..

What am I doing (or not doing!)?

--
- Mitchell

推荐答案

您好


感谢您使用Microsoft MSDN管理新闻组。我的名字是Peter,我将在这个问题上帮助你。

首先,我想确认一下我对你的问题的理解。

从您的描述中,我了解到将应用程序最小化为

系统并反应后,表单上的组件是不可见的。

我完全理解你了吗?如果有什么我误解的话,请

随时告诉我。


我想你可以试试下面的代码。

Private Sub Form1_Resize(ByVal sender As Object,ByVal e As

System.EventArgs)处理MyBase.Resize

如果Me.WindowState = FormWindowState.Minimized那么

Me.Visible = False

Me.ShowInTaskbar = False

结束如果

End Sub

Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object,ByVal e As

System.EventArgs)处理NotifyIcon1.DoubleClick

Me.ShowInTaskbar = True

Me.Visible = True

Me.Activate()


如果Me.WindowState = FormWindowState.Minimized那么

Me.WindowState = FormWindowState.Normal

结束如果

结束子


另外我认为Me.Visible = False是没有必要的你可能试着评论

,看看它是否符合你的要求。


祝你好运,

Peter Huang

Microsoft在线合作伙伴支持


安全! - www.microsoft.com/security

此帖子原样是按原样提供的。没有保证,也没有授予任何权利。

Hi

Thanks for using Microsoft MSDN Managed Newsgroup. My name is Peter, and I
will be assisting you on this issue.
First of all, I would like to confirm my understanding of your issue.
From your description, I understand that after minimized the app into
systray and reactive it the component on the form is invisible.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think you may try the code below.
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.Visible = False
Me.ShowInTaskbar = False
End If
End Sub
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles NotifyIcon1.DoubleClick
Me.ShowInTaskbar = True
Me.Visible = True
Me.Activate()

If Me.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Normal
End If
End Sub

Also I think the Me.Visible = False is not necessary you may try to comment
out it to see if that met your request.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Peter Huang [MSFT]写道:
Peter Huang [MSFT] wrote:
我认为Me.Visible = False是没有必要的,你可以尝试评论
,看看是否符合你的要求。

致以最诚挚的问候,

Peter Huang
微软在线合作伙伴支持
Also I think the Me.Visible = False is not necessary you may try to comment
out it to see if that met your request.

Best regards,

Peter Huang
Microsoft Online Partner Support




是的,彼得,你完全理解我的问题和你的建议

工作!窗口现在在恢复时正常显示。但是,

这似乎引起了另一个问题。当我将ShowInTaskBar设置为

false时,它仍会显示某种幽灵。任务栏上的窗口。它点击时没有反应
,但每次应用程序最小化(并且系统托架中放置了一个

图标)就会出现。还有其他一些技巧吗

让它不显示在除我之外的任务栏中.ShowInTaskbar = False?


感谢!


-

- Mitchell



Yes, Peter, you understood my question exactly and your suggestion
worked! The Window now appears normally when it is restored. However,
this seems to have caused another problem. When I set ShowInTaskBar to
false, it still shows some kind of "ghost" window on the taskbar. It
does not react when clicked but every time the app is minimized (and an
icon put in the systray) it appears. Is there some other trick to
getting it to not show in the taskbar other than me.ShowInTaskbar = False ?

THANKS!

--
- Mitchell


您好


非常感谢您的快速回复!


到目前为止,ShowInTaskbar是管理的方式来控制窗口

在任务栏中显示。

也可以你提供一个简单的重现样本,压缩到一个zip文件和

添加它作为新闻组中的附件,以便我可以做进一步

故障排除,并尝试找到如何解决这个问题。


谢谢!


祝你好运,


Peter Huang
Microsoft在线合作伙伴支持


安全! - www.microsoft.com/security

此帖子原样是按原样提供的。没有保证,也没有授予任何权利。

Hi

Thanks for your quickly reply!

So far the ShowInTaskbar is the managed way to do control if the windows
showed in taskbar.
Also can you provide a simple reproduce sample, compress to a zip file and
add it as an attachment in the newsgroup so that I can do further
troubleshooting and try to find how to workaround the problem.

Thanks!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


这篇关于窗口激活导致控件消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆