I want to place a low width ListBox (One Column only) at the left of the main ListBox.
I want to put a Row number in that ListBox (something like faking a spreadsheet).
After three days, I am still with the paper
white (or so):
I placed a small, 1 column ListBox (say 40 pixels wide) at the left of the main ListBox,
I set its Alignment (ColumnAlignment) to Right,
and I am thinking how I can continue
Tip(s), idea(s), anything is welcome !
I would also like to know this, as it could also be used to simulate line numbering.
Place a ListBox2 on the left of the main listbox1, same height.
In the ListBox1 Open event, addrow from 1 to (ListBox1.Height/ListBox1.RowHeight)+1
Add a 100 ms multiple timer to the window
In the timer Action event, monitor ListBox1.ScrollPosition
If it changes, place the str values starting at Listbox1.ScrollPosition and ending at that plus the number of rows.
Whenever the scrollposition changes, the line numbers on the left ListBox2 are updated.
Will_Shank
(Will Shank)
September 28, 2014, 3:34pm
4
[quote=132273:@Michel Bujardet]Add a 100 ms multiple timer to the window
In the timer Action event, monitor ListBox1.ScrollPosition[/quote]
Instead of a Timer I believe you can check for scroll position change in CellBackgroundPaint.
You are right. Excellent idea.
I have written the post above off the top of my head so CellBackgroundPaint did not come to mind. Thank you.
I noticed when I synchronize a hierarchical listbox to my listbox2, the columns are misaligning due to the hierarchical expansion symbol. Is there a way to correct for this in listbox2?
Thank you,
Robb
As a follow up, both listboxes must be set to hierarchical listbox for the rows to align.