tangxu
2024-10-14 6cd995b71dfc74d4d96347d0bc535fddf36fa9df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Drawing;
 
namespace System.Windows.Forms
{
    public delegate void RibbonElementPopupEventHandler(object sender, RibbonElementPopupEventArgs e);
 
    public class RibbonElementPopupEventArgs : PopupEventArgs
    {
        private readonly PopupEventArgs _args;
 
        public RibbonElementPopupEventArgs(IRibbonElement item)
            : base(item.Owner, item.Owner, false, new Size(-1, -1))
        {
            AssociatedRibbonElement = item;
        }
 
        public RibbonElementPopupEventArgs(IRibbonElement item, PopupEventArgs args)
            : base(args.AssociatedWindow, args.AssociatedControl, args.IsBalloon, args.ToolTipSize)
        {
            AssociatedRibbonElement = item;
            _args = args;
        }
 
        public IRibbonElement AssociatedRibbonElement { get; }
 
 
        public new bool Cancel
        {
            get => _args == null ? base.Cancel : _args.Cancel;
            set
            {
                if (_args != null)
                    _args.Cancel = value;
                base.Cancel = value;
            }
        }
    }
 
}