Home > Back-end >  How at the top of the window to open another window, without being covered
How at the top of the window to open another window, without being covered

Time:10-13

Form1 window to the top, Form2 - & gt; ShowModal () in the Form1, below is covered, how to solve this problem?

Form1 set as follows:
 void __fastcall TForm1: : CreateParams (TCreateParams& Params) 
{
TForm: : CreateParams (Params);
Params. ExStyle |=WS_EX_TOOLWINDOW;
Params. ExStyle |=WS_EX_TOPMOST;
Params. WndParent=0;
}


This question looks be like simple, please answer the test again

CodePudding user response:

No one know

CodePudding user response:

When multiple model window use lz main code, there will be some problems, so, I usually do it:

 void __fastcall TForm1: : FormCreate (TObject * Sender) 
{
If (FormStyle!=fsStayOnTop)
{
TFormStyle TFormStyle=FormStyle;//before you begin to remember the original Settings
FormStyle=fsStayOnTop;//let the window is always in the front (transferred to the front, would have been effective, after may cause model form the pop-up interface in the case of suspected lock)
FormStyle=tFormStyle;//restore original Settings
}
}

CodePudding user response:

The above code in Form2 Form1 used my example

CodePudding user response:

The measured once, don't know the two forms are used:
 
Params. ExStyle |=WS_EX_TOOLWINDOW;
Params. ExStyle |=WS_EX_TOPMOST;
Params. WndParent=0;


In the code that meet the requirements?
  • Related