隐藏表格并使用vb.net还原表格 [英] Hide form and restore form with vb.net

查看:97
本文介绍了隐藏表格并使用vb.net还原表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人

我用vb.net创建了聊天应用程序,但是隐藏表单和恢复表单存在问题.我的意思是我的应用程序已经运行了,但是隐藏了通知图标
并且当用户再次运行它时,它想要恢复表单聊天应用程序.

我用以下代码尝试过:

Dear All

I created chat application with vb.net but I have a problem with hide form and restore form back. I mean my application ran already but it hide with notify icon
and when user run it again, it want to restore form chat application back.

I tried it with this code:

Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal nCmdShow As SHOW_WINDOW) As Boolean
Dim p() As Process = Process.GetProcessesByName("mChat")
If p.Length > 1 Then
    ShowWindow(p(0).MainWindowHandle, SHOW_WINDOW.SW_RESTORE)
End If


但是它无法还原.

有什么想法吗?

谢谢


But it can not restore.

any idea to do that?

Thanks

推荐答案

非常简单,现在就先实现一个notifyicon

使用以下代码使其可见
it is very easy, first implement a notifyicon now

to make it visible use following code
if (!me.Visible)
	{
		me.Visible = true;
		me.Show();
		me.WindowState = FormWindowState.Normal;
	}



隐藏表格



to hide the form

me.Windowstate=Formwindowstate.Minimized
me.hide


这篇关于隐藏表格并使用vb.net还原表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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