mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-28 18:15:47 +02:00
Fix video player seek bar tooltip not disappearing when cursor moves outside
This commit is contained in:
parent
97ad7a3e68
commit
a9c140c0fc
video
@ -19,7 +19,14 @@ public void AttachTooltip(Control control, bool followCursor, Func<MouseEventArg
|
|||||||
Form form = control.FindForm();
|
Form form = control.FindForm();
|
||||||
System.Diagnostics.Debug.Assert(form != null);
|
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)));
|
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));
|
loc.X = Math.Max(0, Math.Min(form.Width-Width, loc.X-Width/2));
|
||||||
|
@ -57,6 +57,10 @@ public FormPlayer(IntPtr handle, int volume, string url, string token){
|
|||||||
trackBarVolume.Value = volume; // changes player volume too if non-default
|
trackBarVolume.Value = volume; // changes player volume too if non-default
|
||||||
|
|
||||||
labelTooltip.AttachTooltip(progressSeek, true, args => {
|
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;
|
IWMPMedia media = Player.currentMedia;
|
||||||
int progress = (int)(media.duration*progressSeek.GetProgress(args.X));
|
int progress = (int)(media.duration*progressSeek.GetProgress(args.X));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user