1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-21 15:15:48 +02:00

Fix video player seek bar tooltip not disappearing when cursor moves outside

This commit is contained in:
chylex 2018-11-20 18:30:06 +01:00
parent 97ad7a3e68
commit a9c140c0fc
2 changed files with 12 additions and 1 deletions

View File

@ -19,7 +19,14 @@ public void AttachTooltip(Control control, bool followCursor, Func<MouseEventArg
Form form = control.FindForm();
System.Diagnostics.Debug.Assert(form != null);
Text = tooltipFunc(args);
string text = tooltipFunc(args);
if (text == null){
Visible = false;
return;
}
Text = text;
Point loc = form.PointToClient(control.Parent.PointToScreen(new Point(control.Location.X+(followCursor ? args.X : control.Width/2), 0)));
loc.X = Math.Max(0, Math.Min(form.Width-Width, loc.X-Width/2));

View File

@ -57,6 +57,10 @@ public FormPlayer(IntPtr handle, int volume, string url, string token){
trackBarVolume.Value = volume; // changes player volume too if non-default
labelTooltip.AttachTooltip(progressSeek, true, args => {
if (args.X < 0 || args.Y < 0 || args.X >= progressSeek.Width || args.Y >= progressSeek.Height){
return null;
}
IWMPMedia media = Player.currentMedia;
int progress = (int)(media.duration*progressSeek.GetProgress(args.X));