Formwindowstate.maximized's Trap

Source: Internet
Author: User

There are many subforms under the MDI parent form. The subform opens with the Formwindowstate.maximized property open, but the result is partly wishful and partly odd.

Paste the code for the single instance first:

 Statictestform _singleton; Public Static voidShowsingleton (formwindowstate windowState = formwindowstate.maximized, Form parent =NULL) {     if(_singleton = =NULL||_singleton.isdisposed) _singleton=Newproductsetting (count); if(Parent! =NULL)//set the parent window, and assign a value to the agent{_singleton.mdiparent=parent; }     if(_singleton.windowstate! = WindowState) _singleton.windowstate =windowState; if(Setting.setfrontwindow! =NULL&&_singleton.ishandlecreated)     Setting.setfrontwindow (_singleton.handle); _singleton.show (); }

So, the call to Testform.showsingleton can show a single instance of the window.

But the same single-instance implementation logic, several Windows maximize the effect is not the same, part is really maximized, the other part of the child window is the size of the initialization, although the minimized and close button is normal.

Compare the rest of the code in several windows, find the Problem window in the window design interface, set the formwindowstate.maximized

The normally displayed window here is the default normal value.

After you restore the window's maximized to normal, the problem is resolved.

It can only be guessed that the property value of WindowState will trigger the recalculation of the window size when it is modified, and the correct result can be obtained by modifying this value when needed.

The crux of the problem is the pit dad. Pay more attention to it later.

Formwindowstate.maximized's Trap

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.