Exemplo n.º 1
0
 private void panel1_MouseUp(object sender, MouseEventArgs e)
 {
     ng.Point p = primitiveList_.Find(context_, e.Location);
     if (p != null && e.Button.HasFlag(MouseButtons.Left))
     {
         p.IsSelected = !p.IsSelected;
         p.Draw(context_);
     }
 }
Exemplo n.º 2
0
        private void panel1_MouseMove(object sender, MouseEventArgs e)
        {
            bool need_full_repaint = false;

            if (e.Button.HasFlag(MouseButtons.Left))
            {
                offset_.X        += e.X - mouse_down_at_.X;
                offset_.Y        += e.Y - mouse_down_at_.Y;
                need_full_repaint = true;
            }

            if (e.Button.HasFlag(MouseButtons.Right))
            {
            }

            if (need_full_repaint)
            {
                context_.SetTransformMatrix(GetTransformMatrix());
                mouse_down_at_.X = e.X;
                mouse_down_at_.Y = e.Y;
                PaintPrimitives();
            }

            ng.Point p = primitiveList_.Find(context_, e.Location);
            if (p != last_hilighted_)
            {
                if (last_hilighted_ != null)
                {
                    last_hilighted_.IsHilighted = false;
                    last_hilighted_.Draw(context_);
                }
                if (p != null)
                {
                    p.IsHilighted = true;
                    p.Draw(context_);
                }
                last_hilighted_ = p;
            }
        }