.net - Adjusting the auto-complete dropdown width on a textbox -
i using textbox in .net 2 winforms app setup custom autocompletesource. there anyway through code can increase width of list appears containing auto complete suggestions?
ideally without increasing width of textbox short space in ui.
not know of, can auto-size textbox wide when needs be, rather wide longest text.
example http://forums.microsoft.com/msdn/showpost.aspx?postid=3311429&siteid=1
public class form1 private withevents t textbox private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load t = new textbox t.setbounds(20, 20, 100, 30) t.font = new font("arial", 12, fontstyle.regular) t.multiline = true t.text = "type here" t.selectall() controls.add(t) end sub private sub t_textchanged(byval sender object, byval e system.eventargs) handles t.textchanged dim width integer = textrenderer.measuretext(t.text, t.font).width + 10 dim height integer = textrenderer.measuretext(t.text, t.font).height + 10 t.width = width t.height = height end sub
end class
Comments
Post a Comment