|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
combobox view display width questionHi
Is there a way to have the view/display width different from the width as it sits on the form? OK, its not the combo control width that i want to set/change, its the width
of the dropdown text value field when someone clicks the combobox. Example: the combo is width 50px but there are values that are 100px long, What I want to do is when the user clicks the combo the drop down part is wider than the combo control. Brian Show quoteHide quote "BrianDH" wrote: > Hi > Is there a way to have the view/display width different from the width as it > sits on the form? Change Dropdown width at runtime
Dim intLength As Integer = CInt(DataSet.Tables(0).Rows.Count) Dim g As Graphics g = ComboBox.CreateGraphics() Dim x As Integer = 0 Dim maxWidth As Integer = 72 Do Until x = intLength Dim w As Integer = CInt(g.MeasureString(DataSet.Tables(0).Rows(x).Item(1).ToString, ComboBox.Font).Width) If (w > maxWidth) Then maxWidth = w End If x = x + 1 Loop g.Dispose() ComboBox.DropDownWidth = maxWidth Show quoteHide quote "BrianDH" wrote: > Hi > Is there a way to have the view/display width different from the width as it > sits on the form? "BrianDH" <Bria***@discussions.microsoft.com> schrieb: Check out the combobox' 'DropDownWidth' property.> Is there a way to have the view/display width different from the width as > it > sits on the form? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||