mirror of
https://github.com/ckaczor/wpf-notifyicon.git
synced 2026-01-17 09:45:38 -05:00
GetTrayLocation now return with GetDeviceCoordinates. Fix in the case of multi-monitor.
Add extension point CustomPopupPosition to show Balloon on custom position. AppBarInfo.WorkArea now return appbar workarea. Before it returns screen workarea.
This commit is contained in:
@@ -145,6 +145,14 @@ namespace Hardcodet.Wpf.TaskbarNotification
|
||||
#endregion
|
||||
|
||||
#region Custom Balloons
|
||||
public delegate Point GetCustomPopupPosition();
|
||||
|
||||
public GetCustomPopupPosition CustomPopupPosition;
|
||||
|
||||
public Point GetPopupTrayPosition()
|
||||
{
|
||||
return TrayInfo.GetTrayLocation();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows a custom control as a tooltip in the tray location.
|
||||
@@ -217,8 +225,8 @@ namespace Hardcodet.Wpf.TaskbarNotification
|
||||
popup.Placement = PlacementMode.AbsolutePoint;
|
||||
popup.StaysOpen = true;
|
||||
|
||||
Point position = TrayInfo.GetTrayLocation();
|
||||
position = GetDeviceCoordinates(position);
|
||||
|
||||
Point position = this.CustomPopupPosition != null ? this.CustomPopupPosition() : this.GetPopupTrayPosition();
|
||||
popup.HorizontalOffset = position.X - 1;
|
||||
popup.VerticalOffset = position.Y - 1;
|
||||
|
||||
@@ -394,7 +402,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
|
||||
WinApi.GetCursorPos(ref cursorPosition);
|
||||
}
|
||||
|
||||
cursorPosition = GetDeviceCoordinates(cursorPosition);
|
||||
cursorPosition = TrayInfo.GetDeviceCoordinates(cursorPosition);
|
||||
|
||||
bool isLeftClickCommandInvoked = false;
|
||||
|
||||
@@ -954,16 +962,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Recalculates OS coordinates in order to support WPFs coordinate
|
||||
/// system if OS scaling (DPIs) is not 100%.
|
||||
/// </summary>
|
||||
/// <param name="point"></param>
|
||||
/// <returns></returns>
|
||||
private Point GetDeviceCoordinates(Point point)
|
||||
{
|
||||
return new Point() { X = (int)(point.X / SystemInfo.DpiXFactor), Y = (int)(point.Y / SystemInfo.DpiYFactor) };
|
||||
}
|
||||
|
||||
|
||||
#region Dispose / Exit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user