Frame on main form with FormStyle = fsMDIForm

…衆ロ難τιáo~ 提交于 2019-12-11 04:42:40

问题


Is there a way to show MDI child forms (FormStyle = fsMDIChild) on the main form that has a frame with Align = alClient?
Creating a frame on the main form:

Frame := TfrCalendar.Create(Self);
Frame.Parent := Self;   

Creating MDI child form on the main form:

if Assigned(FMDIRef)
then
  FMDIRef.BringToFront
else begin
  FMDIRef := TFReference.Create(Application);
  FMDIRef.Show;
end;

After this, the child form is not visible. If you do not create a frame, the form is visible. If you first show the child form, and then create a frame on the main form, then the child form becomes invisible again.


回答1:


The issue here is that your frame is competing for space with the MDI client window. The MDI client window is the window which is parent to the MDI child windows.

In your scenario the frame consumes all remaining client area inside the main window, thus leaving no space for the MDI client window.

What you are attempting is not possible. The MDI client window has to go somewhere, and you must leave it some room.

Depending on what your actual goal is, different solutions are available:

  • If the frame is intended to be visible always, then use alTop. The remaining space below it will be available to the MDI client window.
  • If you wish to show an image on the MDI client window to act as a background, refer to my answer here: https://stackoverflow.com/a/15137740/505088


来源:https://stackoverflow.com/questions/53387891/frame-on-main-form-with-formstyle-fsmdiform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!