Exemplo n.º 1
0
		protected override void OnMouseDown(MouseButtonEventArgs e)
		{
			DesignerCanvas.DeselectAll();
			if (e.LeftButton == MouseButtonState.Pressed)
			{
				DesignerCanvas.DeselectAll();
				StartPoint = e.GetPosition(this);
				_gridLineShape = new GridLineShape(new GridLine(Orientation, StartPoint.Value), _thickness);
				_gridLineShape.DataContext = this;
				switch (Orientation)
				{
					case Orientation.Horizontal:
						AdornerCanvas.Cursor = Cursors.SizeNS;
						break;
					case Orientation.Vertical:
						AdornerCanvas.Cursor = Cursors.SizeWE;
						break;
				}
				AdornerCanvas.Children.Add(_gridLineShape);
				if (!AdornerCanvas.IsMouseCaptured)
					AdornerCanvas.CaptureMouse();
			}
		}
Exemplo n.º 2
0
		private void Cleanup()
		{
			_gridLineShape = null;
			AdornerCanvas.ReleaseMouseCapture();
			AdornerCanvas.Cursor = Cursors.Pen;
		}
Exemplo n.º 3
0
		public void Remove(GridLineShape gridLineShape)
		{
			DesignerCanvas.GridLineController.GridLines.Remove(gridLineShape.GridLine);
			AdornerCanvas.Children.Remove(gridLineShape);
		}