示例#1
0
 /// <summary>
 /// Raises the WndProcHitTest event.
 /// </summary>
 /// <param name="e">A ViewControlHitTestArgs containing the event data.</param>
 protected virtual void OnWndProcHitTest(ViewControlHitTestArgs e)
 {
     if (WndProcHitTest != null)
     {
         WndProcHitTest(this, e);
     }
 }
示例#2
0
        /// <summary>
        /// Process Windows-based messages.
        /// </summary>
        /// <param name="m">A Windows-based message.</param>
        protected override void WndProc(ref Message m)
        {
            // Only interested in intercepting the hit testing
            if (m.Msg == PI.WM_NCHITTEST)
            {
                // Extract the screen point for the hit test
                Point screenPoint = new Point((int)m.LParam.ToInt64());

                // Generate event so message can be processed
                ViewControlHitTestArgs args = new ViewControlHitTestArgs(PointToClient(screenPoint));
                OnWndProcHitTest(args);

                if (!args.Cancel)
                {
                    m.Result = args.Result;
                    return;
                }
            }

            base.WndProc(ref m);
        }