예제 #1
0
 private void DrawableObjectViewer_MouseUp(object sender, MouseEventArgs args)
 {
     if (m_target_objs.Length > 0)
     {
         if (DrawableObjectMouseUp != null)
         {
             DrawableObjectMouseUp(this, new DrawableObjectEventArgs(args, m_target_objs));
         }
         if ((args.Button & MouseButtons.Right) == MouseButtons.Right && DrawableObjectContextMenuStripRequest != null)
         {
             DrawableObjectEventArgs event_args = new DrawableObjectEventArgs(args, m_target_objs);
             DrawableObjectContextMenuStripRequest(this, event_args);
             if (event_args.ContextMenuStrip != null)
             {
                 event_args.ContextMenuStrip.Show(picBoxCanvas, args.X, args.Y);
             }
         }
     }
     else
     {
         if (CanvasMouseUp != null)
         {
             CanvasMouseUp(this, args);
         }
         if ((args.Button & MouseButtons.Right) == MouseButtons.Right && m_canvas_menu != null)
         {
             m_canvas_menu.Show(picBoxCanvas, args.X, args.Y);
         }
     }
 }
예제 #2
0
파일: MainWnd.cs 프로젝트: viidea/latino
 private void drawableObjectViewer1_DrawableObjectTargetChanged(object sender, DrawableObjectEventArgs args)
 {
     string txt = "";
     foreach (Document obj in drawableObjectViewer.TargetObjects)
     {
         txt += string.Format("{0}: {1}\r\nOpposite: {2}\r\n\r\n", obj.Label, obj.Text, obj.OppositeKeywords);
     }
     txtInfo.Text = txt;
 }
예제 #3
0
        private void DrawableObjectViewer_MouseMove(object sender, MouseEventArgs args)
        {
            const int WM_ACTIVATE = 0x0006;

            if (m_drawable_object != null)
            {
                TransformParams             tr                 = new TransformParams(0, 0, m_scale_factor);
                float[]                     dist_array         = null;
                IDrawableObject[]           new_target_objs    = m_drawable_object.GetObjectsAt(args.X, args.Y, tr, ref dist_array);
                Set <IDrawableObject>       new_target_obj_set = new Set <IDrawableObject>(new_target_objs);
                ArrayList <IDrawableObject> exit_objs          = new ArrayList <IDrawableObject>();
                ArrayList <IDrawableObject> enter_objs         = new ArrayList <IDrawableObject>();
                if (DrawableObjectMouseLeave != null || DrawableObjectToolTipRequest != null)
                {
                    foreach (IDrawableObject obj in m_target_objs)
                    {
                        if (!new_target_obj_set.Contains(obj))
                        {
                            exit_objs.Add(obj);
                        }
                    }
                }
                if (DrawableObjectMouseEnter != null || DrawableObjectToolTipRequest != null)
                {
                    foreach (IDrawableObject obj in new_target_objs)
                    {
                        if (!m_target_obj_set.Contains(obj))
                        {
                            enter_objs.Add(obj);
                        }
                    }
                }
                if (DrawableObjectMouseLeave != null && exit_objs.Count > 0)
                {
                    DrawableObjectMouseLeave(this, new DrawableObjectEventArgs(args, exit_objs.ToArray()));
                }
                if (DrawableObjectMouseEnter != null && enter_objs.Count > 0)
                {
                    DrawableObjectMouseEnter(this, new DrawableObjectEventArgs(args, enter_objs.ToArray()));
                }
                if (DrawableObjectToolTipRequest != null && (enter_objs.Count > 0 || exit_objs.Count > 0))
                {
                    if (new_target_objs.Length > 0)
                    {
                        m_drawable_object_tip.SetToolTip(picBoxCanvas, null);
                        DrawableObjectEventArgs event_args = new DrawableObjectEventArgs(args, new_target_objs);
                        DrawableObjectToolTipRequest(this, event_args);
                        m_drawable_object_tip.SetToolTip(picBoxCanvas, event_args.ToolTipText);
                        SendMessage(picBoxCanvas.Handle, WM_ACTIVATE, 0, IntPtr.Zero); // *** I'm not sure why this is required but it is :)
                    }
                    else
                    {
                        m_drawable_object_tip.SetToolTip(picBoxCanvas, null);
                    }
                }
                m_target_obj_set = new_target_obj_set;
                m_target_objs    = new_target_objs;
            }
            if (m_target_objs.Length == 0)
            {
                if (CanvasMouseMove != null)
                {
                    CanvasMouseMove(this, args);
                }
            }
            else
            {
                if (DrawableObjectMouseMove != null)
                {
                    DrawableObjectMouseMove(this, new DrawableObjectEventArgs(args, m_target_objs));
                }
            }
        }