Einzelnen Beitrag anzeigen

venice2
(Gast)

n/a Beiträge
 
#2

AW: Korrekte Zeit ermitteln bei Mouse Move

  Alt 9. Sep 2021, 05:14
Ok hat sich erledigt..

Delphi-Quellcode:
    WM_NCMOUSEMOVE, WM_MOUSEMOVE:
      begin
        if (KVideo_GetPlayerState(MainMovie) = psPlaying) or
          (KVideo_GetPlayerState(MainMovie) = psPaused) then
        begin
          GetCursorPos(p);
          ScreenToClient(WinHandle, p);

          ChildHwnd := ChildWindowFromPoint(WinHandle, p);

          if (ChildHwnd = trbSearch.Handle) and
            not trbSearch.CheckOverThumb(trbSearch.Handle) then
          begin
            GetClientRect(WinHandle, rc);

            if PtInRect(rc, p) then
            begin
              SKAERO_SetCTLText(lblMove.Handle, '');
              GetClientRect(trbSearch.Handle, rc1);

              Img := GDIP_CreateImageFromFile(SKAERO_FOLDER + 'BTN_Thumb.png');
              GDIP_GetImageSize(Img, imgW, imgH);
              GDIP_DisposeImage(Img);

              // Get Max Values from trbSearch
              tMax := trbSearch.MaxVal div 1000;
              // Analyze new Position instead of Mouse Position
              tx := MIN(MAX((p.x - trbSearch.Left) - Integer(imgW) div 2, 0),
                rc1.Right - Integer(imgW));
              range := rc1.Right - Integer(imgW);
              increment := tMax / range;
              tVal := round(increment * tx);
              // Format tVal to DateTime
              Elapsed := FormatDateTime('hh:nn:ss', (tVal / SecsPerDay));
              // Move Label in Center of Cursor
              Left := (p.x - lblMove.Width) + (lblMove.Width div 2) +
                (trbSearch.Left - (Integer(imgW) div 2));
              if Left < trbSearch.Left then
                Left := trbSearch.Left;
              if (Left + lblMove.Width) > (gP.MainWidth - trbSearch.Left) then
                Left := (gP.MainWidth - lblMove.Width) - trbSearch.Left div 2;

              MoveWindow(lblMove.Handle, Left, gP.MainHeight - 112, lblMove.Width,
                lblMove.Height, false);

              SKAERO_SetCTLText(lblMove.Handle, Elapsed);
            end;
          end else
          if not trbSearch.CheckOverThumb(trbSearch.Handle) then
            SKAERO_SetCTLText(lblMove.Handle, '');
        end;
      end;

Geändert von venice2 ( 9. Sep 2021 um 07:20 Uhr)
  Mit Zitat antworten Zitat