0

如果传递了隐藏表单的参数,我需要添加一个命令行选项来隐藏 mi 应用程序...

它是一个 Windows 窗体。

这是我尝试过的,但表格没有隐藏:

Private Sub Parse_Arguments()
    For I As Integer = 0 To My.Application.CommandLineArgs.Count - 1

        If My.Application.CommandLineArgs.Item(I).ToLower = "/s" Then
            Me.Visible = False
            Me.Hide()
            'Me.Visible = True
        End If

    Next
End Sub
4

2 回答 2

4

试试这个技术:它不会隐藏它,但它会被最小化:

Me.WindowState = FormWindowState.Minimized

如果您也不希望它显示在任务栏上,可以添加以下行:

Me.ShowInTaskbar = False
于 2013-04-29T04:56:39.587 回答
1

将 Opacity() 设置为 0(零),并将 FormBorderStyle() 设置为 SizableToolWindow:

Private Sub Parse_Arguments()
    For I As Integer = 0 To My.Application.CommandLineArgs.Count - 1
        If My.Application.CommandLineArgs.Item(I).ToLower = "/s" Then
            Me.Opacity = 0 ' completely invisible
            Me.FormBorderStyle = FormBorderStyle.SizableToolWindow ' hide from alt-tab
            Me.ShowInTaskbar = False
        End If
    Next
End Sub
于 2013-04-29T05:41:20.663 回答