You have almost no knowledge so I have to explain everything to you, and it takes a lot of time.
You have to understand that each control (child) lies either on a UserForm, or on a Page (MultiPage), Frame
(parent). When you specify LEFT, TOP of a control you give it COORDINATES in the coordinate system of ITS PARENT. I will give examples.
On UserForm frm1 you have a MultiPage1 control. You click and you will see in the Properties window its left = 18, top = 24 (I move MultiPage1 to explain). These coordinates are in the UserForm system because MultiPage1 is its child. The xOy system has its origin O in the upper left corner of the UserForm client area, the Oy axis is directed down, the Ox axis is directed to the right. Frame fr1 has left = 120, top = 66. These coordinates are in the MultiPage1 system because Frame fr1 is its child. CommandButton1 has left = 0, top = 0. These coordinates are in Frame fr1 because CommandButton1 is its child. See the image.
uklad.png
Now let's analyze the code.
1. According to my code for fr1.Left = 120, fr1.Top = 66, fr1.width = 132, fr1.height = 78
Label1.left = c.left - 2 = fr1.left - 2 = 120 - 2 = 118
Label1.top = c.top = fr1.top - 2 = 66 - 2 = 64
Label1.width = c.width + 4 = 132 + 4 = 136
Label1.height = c.height + 4 = 78 + 4 = 82
Label1 and fr1 are children of the same parent Page1, so their similar coordinates are calculated in the same coordinate system. Therefore Label1 lies "around" fr1.
2. According to your code for CommandButton1.left = 0, CommandButton.top = 0, CommandButton.width = 132, CommandButton1.height = 72
Label1.left = c.left - 2 = CommandButton1.left - 2 = 0 - 2 = -2
Label1.top = c.top = CommandButton1.top - 2 = 0 - 2 = -2
Label1.width = c.width + 4 = CommandButton1.width + 4 = 132 + 4 = 136
Label1.height = c.height + 4 = CommandButton1.height + 4 = 72 + 4 = 76
Since the code creates Label1 as a child of Page1, the coordinates of CommandButton1.left = -2 and CommandButton1.top = -2 are calculated in the coordinate system of Page1 and not in the coordinate system of Frame fr1. fr1 and Label1 are children of the same parent Page1, so their coordinates are calculated in the same system. fr1.Left = 120, fr1.Top = 66 so fr1 is far from the beginning of the MultiPage Coordinate System, Label1.left = -2, Label1.top = -2, so Label1 is near the beginning of the MultiPage Coordinate System.
Now you will understand why Label1 is on the top corner only?
-------------
Corrected code in the UserForm module frm1
Bookmarks