简体   繁体   中英

How to get the NonClient Upper border size?

I need to allign a secondary form to the right border of other form.

When we compile and run a COMPILED application (not when running it from the IDE) with AERO enabled, this is what happens:

在此处输入图片说明

So thanks to the great asnwer of GJKH here : How to determine correctly the Non-Client Area Size for Aero?

...Now I can allign the secondary form to the right of the main form, But the secondary form stills unaligned a bit of pixels from the top:

在此处输入图片说明

This is the code I'm using:

 If Debugger.IsAttached Then
      Form2.Location = New Point(Me.Right, Me.Top)
 Else
      Form2.Location = New Point((Me.Location.X + (Me.Width + (Me.Width - Me.ClientSize.Width))), Me.Location.Y)
 End If

I put this in an event within Form1:

    Dim frm As New Form2

    frm.Show()

    frm.SetDesktopLocation(Me.Width + Me.DesktopLocation.X, Me.DesktopLocation.Y)

and form2 lined up immediately to the right of form1 with their tops lined up perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM