Improved question
To Answer 2 : Thanks, but I am not to show it only.
To Answer 1 :
(1) If I don't add the line of "
this.Controls.Add(form_2)
", the
form_2
will be shown behind the
form_1
. So, I add this line in
form_1
just below the line of "
initialcomponet()
", so that the
form_2
can be shown in the
form_1
client area.
Plus, I have to add "
form_2.toplevel=false
" before "
this.Controls.add(form_2)
", or, it will show message of "
can not add top level control(form_2) to control(this)", and then it can not run in advanced.
(2) The highlight means to let top bar in
form_2
has highlight blue color. Since I can only see gray blue color of top bar in
form_2
even I click the
form_2
, or add any line of following in
form_1
:
form_2.Show();
form_2.Activate();
form_2.Enabled = true;
form_2.BringToFront();
form_2.Focus();
First question
I have a winform application with a form named
form_1
, I write code in
form_1
to create
form_2
, and I would like to activate the
form_2
with highlight color, however, it fails. The code is below :
1. I create
form_2
and let it be included in
form_1 (this)
Form_help form_2 = new Form_help();
form_2.TopLevel = false;
this.Controls.Add(form_2);
2. I try to activate
form_2
to highlight it with the following lines, but all fails to highlight it.
form_2.Show();
form_2.Activate();
form_2.Enabled = true;
form_2.BringToFront();
form_2.Focus();
The question is how can I highlight the
form_2
? Since I would place multiple forms in
form_1
, and when click any of the forms, the clicked form will be highlight.
I also try the way of
form_1.activecontrol(form_2)
method, but it still fails.