I am making custom scrollbar.

And i got a problem with calculating thumb position.

this is my calculation.

m_curPos = (m_rectThumbPos.CenterPoint().y * m_nMaxValue)/rectScrollbar.Height();

And mine can show at most 12 elements at once.

(With 13 elements, the range of scrollbar will be 0 to 1)

However, like over 21 elements, the logic(m_curPos) is not correct.

if I get the value with float type, i get 1.22.., 2.14.., 3.01.., 3.99....

that's why the position will be wrong.

How to calculate it?? I need your help.

Topic archived. No new replies allowed.