1
0

Slider.h 602 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <windows.h>
  3. #include <commctrl.h>
  4. class Slider
  5. {
  6. public:
  7. Slider(HWND hwndDlg, int id)
  8. {
  9. slider_hwnd = GetDlgItem(hwndDlg, id);
  10. }
  11. void SetRange(WORD low, WORD high, BOOL redraw = TRUE)
  12. {
  13. SendMessage(slider_hwnd, TBM_SETRANGE, redraw, MAKELONG(low,high));
  14. }
  15. void SetPosition(LPARAM position, BOOL redraw = TRUE)
  16. {
  17. SendMessage(slider_hwnd, TBM_SETPOS, redraw, position);
  18. }
  19. void SetTickFrequency(LPARAM frequency)
  20. {
  21. SendMessage(slider_hwnd, TBM_SETTICFREQ, frequency, 0);
  22. }
  23. enum
  24. {
  25. NO_REDRAW = FALSE,
  26. REDRAW = TRUE,
  27. };
  28. private:
  29. HWND slider_hwnd;
  30. };