How to always leave a form behind?

Asked

Viewed 772 times

4

I’m trying to always leave a form underneath the other forms, no matter if the user clicks on it, it should always be below, but usable, something similar to the desktop, and that’s the problem, I’m not able to do that, would like to know what approach I should use.

I read about some ways to always leave it in front, I don’t know if reversing it, to always stay below would work.

  • You’re talking about MDI?

  • Like, you are calling?

  • 3

    @Fulvius, Instantiating and calling. Form1 formulario = new Form1(); and formulario.Show();.

  • 1

    @James, yes, MDI.

  • If it is not MDI use form.Showdialog();

1 answer

3


Your main form should have the property IsMdiContaner set as true.
Child forms, being created within the MDI Container form, should be called as such:

ChildForm form = new ChildForm();
form.MdiParent = this;
form.Show();

Output example:

inserir a descrição da imagem aqui

  • @Fulvius, yes, but he didn’t mention the use of form.MdiParent = this;. And since you said it is MDI you want, you have the main form that needs to be set as MDI Container as well.

  • A child form will appear over the father, what I want is to use the father without throwing the son behind him. Returning the answer, where would that IsMdiContaner? In the form properties?

  • 2

    @Patrick, it still looks like MDI to me. And about IsMdiContainer, yes, it is a property. If you are going to use ShowDialog cannot be a MDIChild.

  • @Tiago, I did what you indicated, two things happened: the form was left with a dark gray background (how could I remove this color?) and when I call the child form, only scroll bars appear around the parent form.

  • @Patrick, the child form you should be ordering automatically maximize. Already about the color, I really don’t know. I tried to change the color in my hand, but I couldn’t.

  • I checked here and he’s not scheduled to automatically maximize, which may be?

  • @Patrick, can you add your code and an image of how it looks, in your question?

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.