コード例 #1
0
ファイル: PopupForm.cs プロジェクト: nhannd/Xian
        /// <summary>
        /// Constructor that creates a new popup form with specified content, owner, and location.
        /// </summary>
        /// <param name="content">The content to show in the popup</param>
        /// <param name="popupOwner">The control that owns the popup.</param>
        /// <param name="location">The location of the popup, in screen coordinates.</param>
        public PopupForm(Control content, Control popupOwner, Point location)
        {
            InitializeComponent();

            _popupOwner = popupOwner;
            _location = location;

            _helper = new PopupWindowHelper();
            _helper.PopupClosed += delegate
            {
                if (_popupClosed != null)
                    _popupClosed(this, EventArgs.Empty);
            };
            _helper.PopupCancel += delegate(object sender, PopupCancelEventArgs e)
            {
                if (_popupCancelled != null)
                {
                    CancelEventArgs c = new CancelEventArgs(e.Cancel);
                    _popupCancelled(this, c);
                    e.Cancel = c.Cancel;
                }
            };

            // size the content appropriately, and size this form to match the content
            content.MinimumSize = content.Size;
            content.Dock = DockStyle.Fill;
            this.ClientSize = content.Size;

            // add content to form
            this.Controls.Add(content);
        }
コード例 #2
0
 /// <summary>
 /// Constructs a new instance of this class and sets the owning
 /// object.
 /// </summary>
 /// <param name="owner">The <see cref="PopupWindowHelper"/> object
 /// which owns this class.</param>
 public PopupWindowHelperMessageFilter(PopupWindowHelper owner)
 {
     this.owner = owner;
 }
コード例 #3
0
 public QuestPartItems()
 {
     InitializeComponent();
     DB.DatabaseLoaded += new DB.DatabaseLoadedEventHandler(DB_DatabaseLoaded);
     popupHelper = new PopupWindowHelper();
 }
コード例 #4
0
 /// <summary>
 /// Constructs a new instance of this class and sets the owning
 /// object.
 /// </summary>
 /// <param name="owner">The <see cref="PopupWindowHelper"/> object
 /// which owns this class.</param>
 public PopupWindowHelperMessageFilter(PopupWindowHelper owner)
 {
     this.owner = owner;
 }