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 If
#End Region #End Region
Dim maxWith As Integer = cmb.Width 'Dim oMaxWidth As Integer = cmb.Width
Using g As Graphics = Me.CreateGraphics
For Each oItem As Object In cmb.Items 'Für alle Einträge... 'Using oGraphics As Graphics = cmb.CreateGraphics()
Dim g1 As Graphics = cmb.CreateGraphics ' Dim oStringLength = oGraphics.MeasureString(Text, cmb.Font).Width
If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then ' If oStringLength + 30 > oMaxWidth Then
maxWith = g1.MeasureString(Text, cmb.Font).Width + 30 ' oMaxWidth = oStringLength + 30
End If ' End If
g1.Dispose() 'End Using
Next oItem
End Using 'Using g As Graphics = Me.CreateGraphics
cmb.DropDownWidth = maxWith ' 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 oControl = cmb
End If End If

View File

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