Shaitan00 Posted July 18, 2007 Posted July 18, 2007 I was wondering if there was a way to CENTER text in a ListBox - specifically I have a listbox (lbInformation) to which I add items [lbInformation.Items.Add(sItem);] and I would like this to be displayed in the listbox as CENTERED text (not default left-justified) however I can't seem to find any settings or properties that allows me to set the text positioning - is there a simple way to achieve this? Any help would be much appreciated. Thanks, Quote
Nate Bross Posted July 18, 2007 Posted July 18, 2007 I'm not by my IDE, but have you looked at the Listbox->Font property? Possibly there is an align value in there, along with color, font face, size, etc... Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
amir100 Posted July 18, 2007 Posted July 18, 2007 It's possible in TextBox. But I don't think it's possible in ListBox. Have you seen it working somewhere? CMIIW. Quote Amir Syafrudin
Leaders snarfblam Posted July 18, 2007 Leaders Posted July 18, 2007 ListBox does not support this feature out of the box. In order to achieve this result you would have to owner draw your ListBox. Quote [sIGPIC]e[/sIGPIC]
Shaitan00 Posted July 18, 2007 Author Posted July 18, 2007 No I already checked all the Apperance Properties (including Font) displayed in the Properties window of the control and there is nothing regarding alignment that can be set (from what I can see). Quote
amir100 Posted July 18, 2007 Posted July 18, 2007 ListBox does not support this feature out of the box. In order to achieve this result you would have to owner draw your ListBox. owner draw? Quote Amir Syafrudin
MrPaul Posted July 18, 2007 Posted July 18, 2007 Owner draw Just as the name suggests... By setting the DrawMode property and overriding the MeasureItem and DrawItem events you can override the default drawing that the framework provides. http://www.google.com/search?hl=en&q=owner+draw+listbox+.net&btnG=Google+Search Quote Never trouble another for what you can do for yourself.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.