Problem about ListBox item
-
I seen many examples about ListBox,in DrawItem they use the state and the action to decide how the item should be drawn. I am puzzled that what is difference between focus and the select or selected.Besides,is the whole ListBox redrawn when I click the item when the program are running?Could somebody give details~? Thanks~
-
I seen many examples about ListBox,in DrawItem they use the state and the action to decide how the item should be drawn. I am puzzled that what is difference between focus and the select or selected.Besides,is the whole ListBox redrawn when I click the item when the program are running?Could somebody give details~? Thanks~
In many controls (like a standard listbox) the focus state and selected state are set at the same time. Having both states gives custom controls a way to indicate keyboard focus without an item being selected or vice-versa.
"If you can dodge a wrench, you can dodge a ball."
-
I seen many examples about ListBox,in DrawItem they use the state and the action to decide how the item should be drawn. I am puzzled that what is difference between focus and the select or selected.Besides,is the whole ListBox redrawn when I click the item when the program are running?Could somebody give details~? Thanks~
In the standard listbox rendering, Focus typically draws a dashed rect around the "current" item and Selected shows the item in color. The difference is useful if you want to e.g. keep the Selected item highlighted when the listbox is not focused. Usually only the affected items are redrawn. For example, if you have item 1 selected and click on item 2, you'd get draw messages for item 1 (with the selected flag cleared) and item 2 (with the selected flag set), but no draw msgs for items 0 or 3. If oyu *scroll* the listbox you'll get draw messages for all visible (either partially or fully) items, but not for those items whose rects fall outside (above/below) the window's client area.