相关疑难解决方法(0)

如何在表单应用程序中显示控制台输出/窗口?

要立即陷入困境,这是一个非常基本的例子:

using System;
using System.Windows.Forms;

class test
{ 
    static void Main()
    { 
        Console.WriteLine("test");
        MessageBox.Show("test");
    }
}
Run Code Online (Sandbox Code Playgroud)

如果我使用默认选项(在命令行使用csc)编译它,正如预期的那样,它将编译到控制台应用程序.另外,因为我导入了System.Windows.Forms,它还会显示一个消息框.

现在,如果我使用该选项/target:winexe,我认为Windows Application与在项目选项中选择相同,正如预期的那样,我只会看到消息框而没有控制台输出.

(事实上​​,从命令行启动它的那一刻,我可以在应用程序完成之前发出下一个命令).

所以,我的问题是 - 我知道你可以从控制台应用程序获得"windows"/表单输出,但是无论如何从Windows应用程序显示控制台?

c# compilation console-application winforms

114
推荐指数
9
解决办法
28万
查看次数

如何在VS Code中添加多个终端?

我们可以在VS Code中添加多个不同的终端吗?我计划添加以下三个终端并与所有这些一起工作

  1. Windows命令提示符
  2. 电源外壳
  3. Git Bash

我知道我需要添加以下命令 Preferences => Setting

 // // 64-bit cmd if available, otherwise 32-bit
 "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe",
// // 64-bit PowerShell if available, otherwise 32-bit
 "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
// // Git Bash
 "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
Run Code Online (Sandbox Code Playgroud)

我想在上面添加以上三个命令 setting.json 在此输入图像描述 当我点击+不同的终端应该打开,我想在不改变首选项的情况下使用这些终端.是否可以在VS Code中使用?

windows-7-x64 visual-studio-code

59
推荐指数
5
解决办法
5万
查看次数