A class that manages the lifetime of an IVwGraphics. Intended usage is using(var gm = new GraphicsManager(this, g)) { // do something with gm.VwGraphics }
Inheritance: IDisposable
Ejemplo n.º 1
0
        private void DoLayout()
        {
            int layoutWidth = LayoutWidth;

            if (Root == null || layoutWidth <= 0 || m_lastLayoutWidth == layoutWidth)
            {
                return;
            }

            using (var gm = new GraphicsManager(this, null))
            {
                Root.Layout(LayoutArg(gm));
            }
            m_lastLayoutWidth = layoutWidth;
            //SetScrollRange(Root.Width, Root.Height);
            Invalidate();
        }
Ejemplo n.º 2
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     Focus();
     if (Root == null || m_lastLayoutWidth == 0)
     {
         return;
     }
     using (var gm = new GraphicsManager(this))
     {
         var sel = m_root.Selection;
         m_root.OnMouseMove(e, ModifierKeys, gm.VwGraphics, PaintArg(gm.VwGraphics));
         if (sel != m_root.Selection)
         {
             Update();                     // need to show the updated selection before we process more movements to get continuous drag effect.
         }
     }
 }
Ejemplo n.º 3
0
		LayoutInfo LayoutArg(GraphicsManager gm)
		{
			var dpiX = (int) Math.Round(gm.DpiX);
			var dpiY = (int) Math.Round(gm.DpiY);
			return new LayoutInfo(Indent, TopMargin, dpiX, dpiY, ClientSize.Width - Indent*2, gm.VwGraphics, RendererFactory);
		}
Ejemplo n.º 4
0
		protected override void OnDragDrop(DragEventArgs drgevent)
		{
			// I don't think we need to support the DragDrop event, apart from our own implementation of it.
			//base.OnDragDrop(drgevent);
			using (var gm = new GraphicsManager(this))
			{
				var location = PointToClient(new Point(drgevent.X, drgevent.Y));
				Root.OnDragDrop(drgevent, location, gm.VwGraphics, PaintArg(gm.VwGraphics));
			}
		}
Ejemplo n.º 5
0
		protected override void OnMouseClick(MouseEventArgs e)
		{
			base.OnMouseClick(e);
			Focus();
			if (Root == null || m_lastLayoutWidth == 0)
				return;
			using (var gm = new GraphicsManager(this))
			{
				Root.OnMouseClick(e, ModifierKeys, gm.VwGraphics, PaintArg(gm.VwGraphics));
			}
		}
Ejemplo n.º 6
0
		protected override void OnMouseMove(MouseEventArgs e)
		{
			base.OnMouseMove(e);
			Focus();
			if (Root == null || m_lastLayoutWidth == 0)
				return;
			using (var gm = new GraphicsManager(this))
			{
				var sel = m_root.Selection;
				m_root.OnMouseMove(e, ModifierKeys, gm.VwGraphics, PaintArg(gm.VwGraphics));
				if (sel != m_root.Selection)
					Update(); // need to show the updated selection before we process more movements to get continuous drag effect.
			}
		}
Ejemplo n.º 7
0
		private void DoLayout()
		{
			int layoutWidth = LayoutWidth;
			if (Root == null || layoutWidth <= 0 || m_lastLayoutWidth == layoutWidth)
				return;

			using (var gm = new GraphicsManager(this, null))
			{
				Root.Layout(LayoutArg(gm));
			}
			m_lastLayoutWidth = layoutWidth;
			//SetScrollRange(Root.Width, Root.Height);
			Invalidate();
		}
Ejemplo n.º 8
0
		private void ScrollToShowSelection()
		{
			if (m_root == null)
				return;
			using (var gm = new GraphicsManager(this))
			{
				int dx, dy;
				Root.ScrollToShowSelection(gm.VwGraphics, PaintArg(gm.VwGraphics), ClientRectangle, out dx, out dy);
				ScrollBy(dx, dy);
			}

		}
Ejemplo n.º 9
0
		protected override void OnPaint(PaintEventArgs e)
		{
			if (Root == null || m_lastLayoutWidth == 0)
				return;
			using (var gm = new GraphicsManager(this, e.Graphics))
			{
				Root.Paint(gm.VwGraphics, PaintArg(gm.VwGraphics));
			}
		}