Data room charging system-how to solve the problem of sub-forms being blocked by picturebox

Source: Internet
Author: User

When I create a data center charging system, I will encounter the following problem: the label, text, commandbutton, and other controls cannot be added to the parent form.

 That is because only controls with align or invisible (such as timer) can be directly placed on the primary form of MDI. Because MDI is the container of other child forms. If a button can be placed, the button will be covered when the subform is displayed. You can first place a control with the align attribute on the MDI. For example, picturebox, and then put the button on picturebox. In this way, the buttons can be indirectly placed on the MDI main form.

  Align attribute: return or set a value to determine whether the object can be displayed in any size, position, or top, bottom, left, or right of the form, and the size is automatically changed to fit the width of the form. The default value of an object in the MDI form is at the top, and its width is equal
Set the scalewidth attribute value.

The picturebox and data controls are the only standard controls that can be placed on the MDI form. The internal area of the MDI form is defined as the space not covered by the control. When an MDI child form is maximized in an MDI parent form, it does not overwrite any controls.

 However, If you stretch the picturebox to an hour as large as the maximum size of the MDI form, the child form cannot be displayed. So how can we solve this problem?

I used the API function ---- setparent

Declaration method:

Private declare functionsetparent lib "USER32" (byval hwndchild as long, byval hwndnewparentas long) as long

Function: This function changes the parent window of a subwindow.

Parameters:

Hwndchild: the sub-window handle. Hwndnewparent: The new parent window handle. If this parameter is null, the desktop window becomes the new parent window.

Return Value: If the function succeeds, the return value is the original parent window handle of the Child Window. If the function fails, the return value is null.

The specific code is:

Privatesub rechargemenu_click ()

Setparentfrmrecharge. hwnd, frmmain. hwnd

Frmrecharge. Show

End sub

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.