By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,179 Members | 2,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,179 IT Pros & Developers. It's quick & easy.

Positioning Non-Child to same position of Child MDI

P: n/a
Hi,.. I have 2 forms with the same width & height, one with 100
opacity and the other with 50% opacity. Since I'm in an MDI
application, the form with the 50% opacity cannot be a MDI Child or
else the Opacity function will not work. My main objective is to
position both forms in the same location. Now since one form is a
non-child form (again, for opacity to work), and the other is a
mdi-child form, how do I go about positioning them in the same place?

I tried doing a NonChild.Left = ChildMdi.Left & NonChild.Top =
ChildMdi.Top , but it renders a different position. It seems to me
that the Top & Left values of the MDI is based on the Parent's MDI
workspace, while the NonChild's Top & Left value is based on the
Desktop's workspace.

Is there anyway around this? It would be easier if the opacity
function works on a MDIChild form. Yes?

Thanks,
Henry
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Since the MDI Child Coordinates are with reference of the MDI Parent, that
is the reason why u can't map them. Try the following instead.

NonChild.Left = Child.Left + MDI.Left
NonChild.Top = Child.Top + MDI.Top

Thank You,
RawCoder

"Henry Wu" <he***********@hotmail.com> wrote in message
news:86*************************@posting.google.co m...
Hi,.. I have 2 forms with the same width & height, one with 100
opacity and the other with 50% opacity. Since I'm in an MDI
application, the form with the 50% opacity cannot be a MDI Child or
else the Opacity function will not work. My main objective is to
position both forms in the same location. Now since one form is a
non-child form (again, for opacity to work), and the other is a
mdi-child form, how do I go about positioning them in the same place?

I tried doing a NonChild.Left = ChildMdi.Left & NonChild.Top =
ChildMdi.Top , but it renders a different position. It seems to me
that the Top & Left values of the MDI is based on the Parent's MDI
workspace, while the NonChild's Top & Left value is based on the
Desktop's workspace.

Is there anyway around this? It would be easier if the opacity
function works on a MDIChild form. Yes?

Thanks,
Henry

Nov 20 '05 #2

P: n/a
> NonChild.Left = Child.Left + MDI.Left
NonChild.Top = Child.Top + MDI.Top


Hi, I've done that but I'm having problems with things like menu,
borders, frames etc..

I made the following code below that makes the 2 forms positioned
perfectly in the same location.

However, here...
----------------------------------
Me.Left = mdiVideoInspectionGlobal.Left + iX_Border +
frmVideoPreviewGlobal.Left + 2

Me.Top = mdiVideoInspectionGlobal.Top + iCaptionHeight + iY_Menu +
frmVideoPreviewGlobal.Top + iY_Border + 2
----------------------------------
Above is part of the code shown below, as you can see there is a plus
2 on both Me.Left & Me.Top, the plus 2 on both is critical for they
make the two forms positioned at the same location with each other.

With you have any clue on what the plus 2 are?

Here is a description of my application:

Title/Caption Bar
Single Menu Bar
B
O MDI-CHILD FORM
R
D
E
R

O
F

M
D
I


Code:
--------------------------------------------
Dim Left As Integer
Dim Top As Integer
Dim iCaptionHeight As Integer
Dim iX_Border As Integer
Dim iY_Border As Integer
Dim iY_Menu As Integer

Debug.WriteLine(GetSystemMetrics(SM_CXBORDER)) '1 'The width
and height, in pixels, of a window border.
Debug.WriteLine(GetSystemMetrics(SM_CYBORDER)) '1 'The width
and height, in pixels, of a window border.
Debug.WriteLine(GetSystemMetrics(SM_CXFRAME)) '4
'Thickness, in pixels, of the sizing border around the perimeter of a
window that can be resized.
Debug.WriteLine(GetSystemMetrics(SM_CYFRAME)) '4
'Thickness, in pixels, of the sizing border around the perimeter of a
window that can be resized.
Debug.WriteLine(GetSystemMetrics(SM_CYMENU)) '19 'Height,
in pixels, of single-line menu bar.
Debug.WriteLine(GetSystemMetrics(SM_CYCAPTION)) '19 'Height,
in pixels, of normal caption area.

iCaptionHeight = GetSystemMetrics(SM_CYCAPTION)
iX_Border = GetSystemMetrics(SM_CXFRAME)
iY_Border = GetSystemMetrics(SM_CYFRAME)
iY_Menu = GetSystemMetrics(SM_CYMENU)

Me.Left = mdiVideoInspectionGlobal.Left + iX_Border +
frmVideoPreviewGlobal.Left + 2
Me.Top = mdiVideoInspectionGlobal.Top + iCaptionHeight +
iY_Menu + frmVideoPreviewGlobal.Top + iY_Border + 2
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.