LookupGrid: Fix Form text, fix form sticking out of monitor when there is no space

This commit is contained in:
Jonathan Jenne
2022-04-01 11:03:57 +02:00
parent 6891642b37
commit 87335beff8
5 changed files with 21 additions and 8 deletions

View File

@@ -257,13 +257,26 @@ Public Class RepositoryItemLookupControl3
.PreventDuplicates = PreventDuplicates,
.DataSource = DataSource,
.SelectedValues = SelectedValues,
.StartPosition = FormStartPosition.Manual,
.Location = OwnerEdit.PointToScreen(New Point(OwnerEdit.Width, 0))
.StartPosition = FormStartPosition.Manual
}
Dim oScreen = Screen.FromControl(oForm)
oForm.Location = GetFormLocation(oForm.Height, oForm.Width, oScreen)
Return oForm
End Function
Private Function GetFormLocation(pFormHeight As Integer, pFormWidth As Integer, pScreen As Screen) As Point
' This is the location on the same height like the Lookup Control
Dim oDefaultLocation = OwnerEdit.PointToScreen(New Point(OwnerEdit.Width, 0))
Dim oScreenheight = pScreen.Bounds.Height
If oScreenheight < (oDefaultLocation.Y + pFormHeight) Then
Return OwnerEdit.PointToScreen(New Point(OwnerEdit.Width, -pFormHeight + OwnerEdit.Height))
End If
Return oDefaultLocation
End Function
Protected Overrides Sub RaiseButtonClick(e As ButtonPressedEventArgs)
MyBase.RaiseButtonClick(e)