示例#1
0
        protected virtual bool HandleNCLButtonDown(ref Message m)
        {
            Activate();

            start            = Cursor.Position;
            virtual_position = form.Bounds;

            int x = Control.LowOrder((int)m.LParam.ToInt32());
            int y = Control.HighOrder((int)m.LParam.ToInt32());

            // Need to adjust because we are in NC land
            NCPointToClient(ref x, ref y);
            FormPos pos = FormPosForCoords(x, y);

            if (form.ActiveMenu != null && XplatUI.IsEnabled(form.Handle))
            {
                MouseEventArgs mea = new MouseEventArgs(Form.FromParamToMouseButtons(m.WParam.ToInt32()), form.mouse_clicks, x, y - TitleBarHeight, 0);
                form.ActiveMenu.OnMouseDown(form, mea);
            }

            if (pos == FormPos.TitleBar)
            {
                HandleTitleBarDown(x, y);
                return(true);
            }

            if (IsSizable)
            {
                if ((pos & FormPos.AnyEdge) == 0)
                {
                    return(false);
                }

                virtual_position = form.Bounds;
                state            = State.Sizing;
                sizing_edge      = pos;
                form.Capture     = true;
                return(true);
            }

            return(false);
        }
示例#2
0
        protected virtual bool HandleNCMouseMove(ref Message m)
        {
            int x = Control.LowOrder((int)m.LParam.ToInt32( ));
            int y = Control.HighOrder((int)m.LParam.ToInt32( ));

            NCPointToClient(ref x, ref y);
            FormPos pos = FormPosForCoords(x, y);

            if (pos == FormPos.TitleBar)
            {
                HandleTitleBarMouseMove(x, y);
                return(true);
            }

            if (form.ActiveMenu != null && XplatUI.IsEnabled(form.Handle))
            {
                MouseEventArgs mea = new MouseEventArgs(Form.FromParamToMouseButtons(m.WParam.ToInt32()), form.mouse_clicks, x, y, 0);
                form.ActiveMenu.OnMouseMove(form, mea);
            }

            return(true);
        }