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, .PreventDuplicates = PreventDuplicates,
.DataSource = DataSource, .DataSource = DataSource,
.SelectedValues = SelectedValues, .SelectedValues = SelectedValues,
.StartPosition = FormStartPosition.Manual, .StartPosition = FormStartPosition.Manual
.Location = OwnerEdit.PointToScreen(New Point(OwnerEdit.Width, 0))
} }
Dim oScreen = Screen.FromControl(oForm)
oForm.Location = GetFormLocation(oForm.Height, oForm.Width, oScreen)
Return oForm Return oForm
End Function 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) Protected Overrides Sub RaiseButtonClick(e As ButtonPressedEventArgs)
MyBase.RaiseButtonClick(e) MyBase.RaiseButtonClick(e)

View File

@ -94,9 +94,9 @@ Namespace My.Resources
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Bitte wählen Sie einen oder mehrere Werte aus: ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die Bitte wählen Sie einen oder mehrere Werte aus: ähnelt.
'''</summary> '''</summary>
Friend Shared ReadOnly Property PopupForm_TextMultiLine() As String Friend Shared ReadOnly Property PopupForm_TextMultiselect() As String
Get Get
Return ResourceManager.GetString("PopupForm_TextMultiLine", resourceCulture) Return ResourceManager.GetString("PopupForm_TextMultiselect", resourceCulture)
End Get End Get
End Property End Property
End Class End Class

View File

@ -126,7 +126,7 @@
<data name="PopupForm_Text" xml:space="preserve"> <data name="PopupForm_Text" xml:space="preserve">
<value>Please choose a value:</value> <value>Please choose a value:</value>
</data> </data>
<data name="PopupForm_TextMultiLine" xml:space="preserve"> <data name="PopupForm_TextMultiselect" xml:space="preserve">
<value>Please choose one or more values:</value> <value>Please choose one or more values:</value>
</data> </data>
</root> </root>

View File

@ -126,7 +126,7 @@
<data name="PopupForm_Text" xml:space="preserve"> <data name="PopupForm_Text" xml:space="preserve">
<value>Bitte wählen Sie einen Wert aus:</value> <value>Bitte wählen Sie einen Wert aus:</value>
</data> </data>
<data name="PopupForm_TextMultiLine" xml:space="preserve"> <data name="PopupForm_TextMultiselect" xml:space="preserve">
<value>Bitte wählen Sie einen oder mehrere Werte aus:</value> <value>Bitte wählen Sie einen oder mehrere Werte aus:</value>
</data> </data>
</root> </root>

View File

@ -65,10 +65,10 @@ Public Class frmLookupGrid
oCheckboxColumn.OptionsColumn.AllowFocus = False oCheckboxColumn.OptionsColumn.AllowFocus = False
Text = _R.GetString("PopupForm_Text") Text = _R.GetString("PopupForm_TextMultiselect")
_DataColumn = 1 _DataColumn = 1
Else Else
Text = _R.GetString("PopupForm_TextMultiLine") Text = _R.GetString("PopupForm_Text")
_DataColumn = 0 _DataColumn = 0
End If End If