Solved

CSliderCtrl caluclate Mouse click to Position

Posted on 2009-04-11
3
1,330 Views
Last Modified: 2013-11-20
Hello,

I want to save in a csliderctrl a extended GetPos. This GetPosEx() will return the real position inside a trackbar of a CSliderCtrl.  To Set this I want to do this inside the OnLButtonClick where I have only the position of the mouselick. How to calculate the real position/value of the slider at this position. My Slider has 0-100 value.

Ocrana
0
Comment
Question by:Ocrana
3 Comments
 
LVL 4

Accepted Solution

by:
StefanKittel earned 500 total points
ID: 24126996
Hello,

I'm not sure I got everything.
You wan't to calucalte the position of your silder from the absolut mouse position?

OK.
You got the mouse position
You need the top left position from your slider using GetWindowPos
You need the size from your slider using GetWindowPos
I'm not sure how to get the size of the knobs left and right. I'll use them as consts and get the size by a screenshot.

pos = mouse pox X * ((right - left - (2 * knob)) / 100)

Stefan
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 24132967
The specific answer depends on how you obtain the position of the mouse pointer.  The calculations will be different depending on if the location is expressed in screen-global or client-local coordinates.
0
 

Author Closing Comment

by:Ocrana
ID: 31569235
No finaly what I needed but helps me alot.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now