Вопрос

Here is a sample form I want to minimize.

This is the original size of the form:

original form size

When it is minimized it should hide other parts of the form and only display a specific area and should look like this:

minimized form

I should be able to return back the form to its original state and vice versa. Is this possible? I have only tried minimizing a form to the taskbar but I have not tried this approach and I wanted to know if this can be possible because I find this feature very handy.

Это было полезно?

Решение

Just use two Panel controls, both with Dock = Top. Then it just takes two lines of code to switch between the expanded and collapsed view:

    panel1.Visible = !panel1.Visible;
    this.ClientSize = new Size(this.ClientSize.Width, panel2.Bottom);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top