mfc - CSliderCtrl convert slider position to pixel position in the control, and vice-versa -


my question regarding csliderctrl. don't know exact terminology try. want convert slider position pixel position in control, , vice-versa. "pixel position", mean point.x , point.y in onlbuttondown when click above slider in tic mark area. imagine want click tic mark , have slider move location. on different coordinate systems.

i have following equation elsewhere convert pixel position slider position, doesn't come out quite correct in practice, maybe 3% off or so:

crect rectclient, rectchannel; getclientrect(rectclient); getchannelrect(rectchannel); int npos = (getrangemax() - getrangemin()) * (point.x - rectclient.left - rectchannel.left) / (rectchannel.right - rectchannel.left); 

i need equations going both directions. ron


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -