1
I need my child Forms to stand in front of the parent form, up to there blz. Only they stand on top of any other window or program. I wonder if there are ways the child Forms stay only in front of the parent form and when other windows or programs are opened they do not get in front.
Code that opens the child form
FormCadastroCliente formCli;
private void BtnCliente_Click(object sender, EventArgs e)
{
bool _found = false;
foreach (Form _openForm in Application.OpenForms)
{
if (_openForm is FormCadastroCliente)
{
_openForm.Focus();
_found = true;
}
}
if (!_found)
{
formCli = new FormCadastroCliente();
formCli.Show();
formCli.BringToFront();
formCli.TopMost = true;
}
}
Try to take out Topmost = true and leave only Bringtofront();
– perozzo
if the intention is not to let access the parent form, while the child is open, where you open the child form, change
formCli.Show();
forformCli.ShowDialog();
– Rovann Linhalis
The two suggestions already tried, what happens is if I take the Topmost and click on the parent form the son form falls behind, if I exchange Show for showDialog while a child form is open I can not click anything in the parent form.
– Rafa
and what the goal after all ?
– Rovann Linhalis
The goal already achieved: Open the parent form, after that open one or more son Forms. Child Forms are always in front of the parent form even by clicking on the parent form. Now the main goal: When you have one or more child forms already opened and open a windows folder for example, I want the child form opened behind the open folder (which is not happening) The child forms are above everything, all the same.
– Rafa
"while a child form is open I can not click anything in the parent form" but you want the form in front of the parent... how q will click something ?! similarly... if the son has to be in front of the father... as q will open "one or more Forms son"? ?
– Rovann Linhalis
It’s a Rovann system, I can open up client records and product records at the same time. The way I made this working as I want, only that the son Forms are in front of everything, any window, I just want to solve this.
– Rafa
so dude... the behavior of the Forms is the same as other windows windows... or she’s
TopMost
who will stand in front of everything... or isModal
that "stands in front of all windows of the application, waiting for a user response" or is a normal form, and will be in front of the active form... there is also mdi Child, but I think it does not apply to the case– Rovann Linhalis
https://msdn.microsoft.com/pt-br/library/39wcs2dh%28v=vs.110%29.aspx? f=255&Mspperror=-2147217396
– Rovann Linhalis