コード例 #1
0
        void ITopWindowEventRoot.RootMouseUp(int x, int y, int button)
        {
            int xdiff = x - prevLogicalMouseX;
            int ydiff = y - prevLogicalMouseY;

            this.prevLogicalMouseX = x;
            this.prevLogicalMouseY = y;


            UIMouseEventArgs e = GetFreeMouseEvent();

            SetUIMouseEventArgsInfo(e, x, y, 0, button);
            e.SetDiff(xdiff, ydiff);
            //----------------------------------
            e.IsDragging = isDragging;

            this.isMouseDown = this.isDragging = false;

            DateTime snapMouseUpTime = DateTime.Now;
            TimeSpan timediff        = snapMouseUpTime - lastTimeMouseUp;

            this.lastTimeMouseUp = snapMouseUpTime;

            if (this.isDragging)
            {
                if (draggingElement != null)
                {
                    //send this to dragging element first
                    int d_GlobalX, d_globalY;
                    draggingElement.GetGlobalLocation(out d_GlobalX, out d_globalY);
                    e.SetLocation(e.GlobalX - d_GlobalX, e.GlobalY - d_globalY);
                    e.CapturedMouseX = this.localMouseDownX;
                    e.CapturedMouseY = this.localMouseDownY;
                    var iportal = draggingElement as IEventPortal;
                    if (iportal != null)
                    {
                        iportal.PortalMouseUp(e);
                        if (!e.IsCanceled)
                        {
                            draggingElement.ListenMouseUp(e);
                        }
                    }
                    else
                    {
                        draggingElement.ListenMouseUp(e);
                    }
                }
            }
            else
            {
                e.IsAlsoDoubleClick = timediff.Milliseconds < dblClickSense;
                iTopBoxEventPortal.PortalMouseUp(e);
            }

            this.localMouseDownX  = this.localMouseDownY = 0;
            this.mouseCursorStyle = e.MouseCursorStyle;
            ReleaseMouseEvent(e);
        }