Help Center

CTrackbar.GetTicPosmethod

Retrieves the length of the slider in a trackbar.

WindowsmethodCTrackbar.incdocumented

Syntax

FUNCTION GetTicPos (BYVAL hTrackbar AS HWND, BYVAL iTic AS DWORD) AS LONG

Parameters

NameDescription
hTrackbarHandle to the trackbar control.
iTicZero-based index identifying a tick mark. The positions of the first and last tick marks are not directly available via this message.

Return value

Returns the distance, in client coordinates, from the left or top of the trackbar's client area to the specified tick mark. The return value is the x-coordinate of the tick mark for a horizontal trackbar or the y-coordinate for a vertical trackbar. If iTic is not a valid index, the return value is -1.

Remarks Because the first and last tick marks are not available through this message, valid indexes are offset from their tick position on the trackbar. If the difference between TBM_GETRANGEMIN and TBM_GETRANGEMAX is less than two, then there is no valid index and this message will fail.

The following illustrates the relation between the ticks on a trackbar, the ticks available through this message, and their zero-based indexes.

Description

Retrieves the current physical position of a tick mark in a trackbar.

Example

0 1 2 3 4 5 6 7 8 9 // Tick positions seen on the trackbar. 1 2 3 4 5 6 7 8 // Tick positions whose position can be identified. 0 1 2 3 4 5 6 7 // Index numbers for the identifiable positions.

Reference

  • Include file CTrackbar.inc
  • Defined in AfxNova/CTrackbar.inc:270
  • Documented in Windows/WIndows Controls/CTrackbar Class.md
  • Topic: CTrackbar Class