cef3实现点击按钮弹出页面_确定哪个CustomPopupPlacement用于WPF弹出窗口

I'm trying to figure out which of the passed in array of CustomPopupPlacement positions have been used when the popup actually renders. Is there any event to detect this?

This msdn thread from 2009 seems to be exactly my issue however there does not seem to be an answer for it.

The marked answer seems invalid and my situation is exactly as the OP in the thread.

I'm going to have my popup with 4 paths and use a DP to toggle visibility on three paths to choose the correct arrow path being rendered.

So given we provide 4 placement options via the CustomPopupPlacementCallbackdelegate, Is there a way to detect which of the 4 positions the system finally chose after dealing with screen edge cases and the sorts.

解决方案

I have a little hacky solution.

Save the custom points as fields in the derived TooTip class and override the OnOpened method.

protected override void OnOpened(RoutedEventArgs e)

{

base.OnOpened(e);

var p = this.TranslatePoint(new Point(0, 0), this.PlacementTarget);

var diff1 = this.first - p;

var diff2 = this.second - p;

if (Math.Abs(Math.Min(diff1.Length, diff2.Length) - diff1.Length) < 0.01)

{

// First Point

}

else

{

// Second Point

}

}

Better solutions are welcome

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值