예제 #1
0
        protected override void OnOriginChanged(ViewOriginEventArgs evtArgs)
        {
            if (evtArgs.NewOrigin.X < -m_Diagram.Width/2)
            {
                this.Origin = new PointF(-m_Diagram.Width/2, evtArgs.NewOrigin.Y);
                return;
            }

            if (evtArgs.NewOrigin.Y < -m_Diagram.Height/2)
            {
                this.Origin = new PointF(evtArgs.NewOrigin.X, -m_Diagram.Height/2);
                return;
            }

            if (evtArgs.NewOrigin.X + m_Diagram.Width > m_document.LogicalSize.Width)
            {
                this.Origin = new PointF(m_document.LogicalSize.Width - m_Diagram.Width, evtArgs.NewOrigin.Y);
                return;
            }

            if (evtArgs.NewOrigin.Y + m_Diagram.Height > m_document.LogicalSize.Height)
            {
                this.Origin = new PointF(evtArgs.NewOrigin.X, m_document.LogicalSize.Height - m_Diagram.Height);
                return;
            }

            base.OnOriginChanged(evtArgs);

            if (m_ConnectedView != null)
            {
                if (m_ConnectedView.Origin != evtArgs.NewOrigin)
                    m_ConnectedView.Origin = evtArgs.NewOrigin;

                m_ConnectedView.Repaint();
            }

        }
예제 #2
0
 void EventSink_OriginChanged(ViewOriginEventArgs evtArgs)
 {
     listBox1.Items.Add("\nOriginChanged event Fired.\n");
 }