How to emulate a console in WPF?

后端 未结 3 2094
北海茫月
北海茫月 2020-12-29 09:29

I\'d like some tips-in-the-right-direction or even ready solutions to this problem and I\'m pretty stuck (I\'m just beginner/intermediate):

I\'m trying to implement

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 10:22

    Did you know that you can display a Console window from your application by using AllocConsole?

    This is a simple way to create a "dual-mode" application can be a console or windows forms application.

    [DllImport("kernel32")]
    static extern bool AllocConsole();
    

    Or you can use this:

    
        
            
            
        
        
        
            
        
    
    

    For better looks, replace the TextBlock with a ListBox and style the ItemTemplate accordingly.

提交回复
热议问题