简体   繁体   中英

How to create a output log window similar to visual studio log window

I need to add an output window to my windows form, similar to the output window in visual studio. 在此处输入图片说明

What i have done is created a list box and planning to log the details as and when they arrive. I dont know how to add the highlighted button controls (close, windows position, autohide). I am completely new to visual studio, winforms, c#. Just exploring various things to draft an application. I would be nice if anyone could suggest ideas in adding those controls.

And also please suggest if there is an alternative to list box to display the output window.

You can use SplitContainer and add Textbox or RichTextbox as output window you want. You can then append output text to the text property of Textbox ot RichTextbox. Instead of highlighted controls, you can change the size of SplitContainer at run time, or hide one of the section using menu option.

~Nilesh

Based on Sam W 's comment, Using DockPanel would create a another window inside the winform, similar to output, error window in Visual Studio IDE.

dockpanelsuite.com

This site provides amazing Docking Features http://docs.dockpanelsuite.com/ provides steps to install them.

In Form 1, set isMidiContainer = true in Form1's Properties and drag the DockPanel from toolBox(after installing and following steps in that page).

create a form2 and add the following

using WeifenLuo.WinFormsUI.Docking;

namespace Forms
{
  public partial class Form2 : DockContent
  {
     public Form2()
    {
       InitializeComponent();
    }
 }
}

In Form1 add

public Form1()
{
  InitializeComponent();
  Form2 f2 = new Form2();
  f2.Show(dockPanel, DockState.DockBottom);
}

We can add many more forms and dock them to one parent form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM