remove measurestring calls from comboboxes for now

This commit is contained in:
Jonathan Jenne 2020-10-14 14:39:11 +02:00
parent 3f97727cee
commit f59a56843c
2 changed files with 67 additions and 33 deletions

View File

@ -273,17 +273,31 @@ Public Class frmMassValidator
End If
#End Region
Dim maxWith As Integer = cmb.Width
Using g As Graphics = Me.CreateGraphics
For Each oItem As Object In cmb.Items 'Für alle Einträge...
Dim g1 As Graphics = cmb.CreateGraphics
If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then
maxWith = g1.MeasureString(Text, cmb.Font).Width + 30
End If
g1.Dispose()
Next oItem
End Using
cmb.DropDownWidth = maxWith
'Dim oMaxWidth As Integer = cmb.Width
'Using oGraphics As Graphics = cmb.CreateGraphics()
' Dim oStringLength = oGraphics.MeasureString(Text, cmb.Font).Width
' If oStringLength + 30 > oMaxWidth Then
' oMaxWidth = oStringLength + 30
' End If
'End Using
'Using g As Graphics = Me.CreateGraphics
' For Each oItem As Object In cmb.Items 'Für alle Einträge...
' Dim g1 As Graphics = cmb.CreateGraphics
' If g1.MeasureString(Text, cmb.Font).Width + 30 > oMaxWidth Then
' oMaxWidth = g1.MeasureString(Text, cmb.Font).Width + 30
' End If
' g1.Dispose()
' Next oItem
'End Using
'cmb.DropDownWidth = oMaxWidth
oControl = cmb
End If

View File

@ -906,17 +906,26 @@ Public Class frmValidator
#End Region
Dim maxWith As Integer = oComboBox.Width
Using g As Graphics = Me.CreateGraphics
For Each oItem As Object In oComboBox.Items 'Für alle Einträge...
Dim g1 As Graphics = oComboBox.CreateGraphics
If g1.MeasureString(Text, oComboBox.Font).Width + 30 > maxWith Then
maxWith = g1.MeasureString(Text, oComboBox.Font).Width + 30
End If
g1.Dispose()
Next oItem
End Using
oComboBox.DropDownWidth = maxWith
'Dim oMaxWidth As Integer = oComboBox.Width
'Using oGraphics As Graphics = oComboBox.CreateGraphics()
' Dim oStringLength = oGraphics.MeasureString(Text, oComboBox.Font).Width
' If oStringLength + 30 > oMaxWidth Then
' oMaxWidth = oStringLength + 30
' End If
'End Using
'Using g As Graphics = Me.CreateGraphics
' For Each oItem As Object In oComboBox.Items 'Für alle Einträge...
' Dim g1 As Graphics = oComboBox.CreateGraphics
' If g1.MeasureString(Text, oComboBox.Font).Width + 30 > oMaxWidth Then
' oMaxWidth = g1.MeasureString(Text, oComboBox.Font).Width + 30
' End If
' g1.Dispose()
' Next oItem
'End Using
'oComboBox.DropDownWidth = oMaxWidth
oMyControl = oComboBox
End If
@ -2269,17 +2278,28 @@ Public Class frmValidator
cmbpanel.DisplayMember = resultDT.Columns(0).ColumnName
cmbpanel.ValueMember = resultDT.Columns(0).ColumnName
Dim maxWith As Integer = cmbpanel.Width
Using g As Graphics = Me.CreateGraphics
For Each oItem As Object In cmbpanel.Items 'Für alle Einträge...
Dim g1 As Graphics = cmbpanel.CreateGraphics
If g1.MeasureString(Text, cmbpanel.Font).Width + 30 > maxWith Then
maxWith = g1.MeasureString(Text, cmbpanel.Font).Width + 30
End If
g1.Dispose()
Next oItem
End Using
cmbpanel.DropDownWidth = maxWith
'Dim oMaxWidth As Integer = cmbpanel.Width
'Using oGraphics As Graphics = cmbpanel.CreateGraphics()
' Dim oStringLength = oGraphics.MeasureString(Text, cmbpanel.Font).Width
' If oStringLength + 30 > oMaxWidth Then
' oMaxWidth = oStringLength + 30
' End If
'End Using
'Using g As Graphics = Me.CreateGraphics
' For Each oItem As Object In cmbpanel.Items 'Für alle Einträge...
' Dim g1 As Graphics = cmbpanel.CreateGraphics
' If g1.MeasureString(Text, cmbpanel.Font).Width + 30 > oMaxWidth Then
' oMaxWidth = g1.MeasureString(Text, cmbpanel.Font).Width + 30
' End If
' g1.Dispose()
' Next oItem
'End Using
'cmbpanel.DropDownWidth = oMaxWidth
ElseIf displayboxname.StartsWith(ClassControlCreator.PREFIX_LOOKUP) Or displayboxname.StartsWith(ClassControlCreator.PREFIX_TABLE) Then
LOGGER.Warn("Depending_Control_Set_Result PREFIX_LOOKUP NOT IMPLEMENTED")