需求:
設置來源資料中最大長度的字串為寬度
程式(VB):
Dim graphics = CreateGraphics()
Dim graphics = CreateGraphics()
columnSex.DropDownWidth = _
(From width In (From item As DataRow In dt供應商.Rows _
Select Convert.ToInt32(graphics.MeasureString(item("供應商簡稱").ToString, Font).Width)) _
Select width).Max
參考:
沒有留言:
張貼留言