This commit is contained in:
Digital Data - Marlon Schreiber
2018-07-12 16:07:47 +02:00
9 changed files with 438 additions and 292 deletions

View File

@@ -520,26 +520,31 @@ Public Class frmIndex
If NewDataset.Tables(0).Rows.Count > 0 Then
'Die Standardcombobox anlegen
newCMB = addCombobox(indexname, y)
'Die Standargrösse definieren
Dim newWidth As Integer = 300
For i = 0 To NewDataset.Tables(0).Rows.Count - 1
'MsgBox(NewDataset.Tables(0).Rows(i).Item(0))
AddComboBoxValue(newCMB, NewDataset.Tables(0).Rows(i).Item(0))
Try
Dim text As String = NewDataset.Tables(0).Rows(i).Item(0)
If text.Length > 15 Then
Dim g As Graphics = newCMB.CreateGraphics
If g.MeasureString(text, newCMB.Font).Width + 30 > newWidth Then
newWidth = g.MeasureString(text, newCMB.Font).Width + 30
End If
g.Dispose()
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Anpassung Breite ComboBox:")
End Try
Next
newCMB.Size = New Size(newWidth, 27)
newCMB.DataSource = NewDataset.Tables(0)
newCMB.DisplayMember = NewDataset.Tables(0).Columns(0).ColumnName
'Die Standargrösse definieren
'Dim newWidth As Integer = 300
'For i = 0 To NewDataset.Tables(0).Rows.Count - 1
' 'MsgBox(NewDataset.Tables(0).Rows(i).Item(0))
' AddComboBoxValue(newCMB, NewDataset.Tables(0).Rows(i).Item(0))
' Try
' Dim text As String = NewDataset.Tables(0).Rows(i).Item(0)
' If text.Length > 15 Then
' Dim g As Graphics = newCMB.CreateGraphics
' If g.MeasureString(text, newCMB.Font).Width + 30 > newWidth Then
' newWidth = g.MeasureString(text, newCMB.Font).Width + 30
' End If
' g.Dispose()
' End If
' Catch ex As Exception
' MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Anpassung Breite ComboBox:")
' End Try
'Next
'newCMB.Size = New Size(newWidth, 27)
newCMB.AutoCompleteSource = AutoCompleteSource.ListItems
newCMB.AutoCompleteMode = AutoCompleteMode.Suggest
newCMB.DropDownHeight = (newCMB.ItemHeight + 0.2) * 25