Beispiel #1
0
        public override void Initialize()
        {
            PRoot  root  = Canvas.Root;
            PLayer layer = Canvas.Layer;

            PNode n      = PPath.CreateRectangle(0, 0, 100, 80);
            PNode sticky = PPath.CreateRectangle(0, 0, 50, 50);

            PBoundsHandle.AddBoundsHandlesTo(n);
            sticky.Brush = Color.Yellow;
            PBoundsHandle.AddBoundsHandlesTo(sticky);

            layer.AddChild(n);
            Canvas.Camera.AddChild(sticky);

            PCamera otherCamera = new PCamera();

            otherCamera.AddLayer(layer);
            root.AddChild(otherCamera);

            PCanvas other = new PCanvas();

            other.Camera = otherCamera;
            PForm result = new PForm(false, other);

            result.StartPosition = FormStartPosition.Manual;
            result.Location      = new System.Drawing.Point(this.Location.X + this.Width, this.Location.Y);
            result.Size          = this.Size;
            result.Show();
        }
Beispiel #2
0
        public override void Initialize()
        {
            PPath sticky = PPath.CreateRectangle(0, 0, 50, 50);;

            sticky.Brush = Color.Yellow;
            sticky.Pen   = null;
            PBoundsHandle.AddBoundsHandlesTo(sticky);
            Canvas.Layer.AddChild(PPath.CreateRectangle(0, 0, 100, 80));
            Canvas.Camera.AddChild(sticky);
        }
        public override void Initialize()
        {
            PRoot   root          = Canvas.Root;
            PCamera camera        = Canvas.Camera;
            PLayer  mainLayer     = Canvas.Layer;               // viewed by the PCanvas camera, the lens is added to this layer.
            PLayer  sharedLayer   = new PLayer();               // viewed by both the lens camera and the PCanvas camera
            PLayer  lensOnlyLayer = new PLayer();               // viewed by only the lens camera

            root.AddChild(lensOnlyLayer);
            root.AddChild(sharedLayer);
            camera.AddLayer(0, sharedLayer);

            PLens lens = new PLens();

            lens.SetBounds(10, 10, 80, 110);
            lens.AddLayer(0, lensOnlyLayer);
            lens.AddLayer(1, sharedLayer);
            mainLayer.AddChild(lens);
            PBoundsHandle.AddBoundsHandlesTo(lens);

            // Create an event handler that draws squiggles on the first layer of the bottom
            // most camera.
            PDragSequenceEventHandler squiggleEventHandler = new SquiggleEventHandler();

            // add the squiggle event handler to both the lens and the
            // canvas camera.
            lens.Camera.AddInputEventListener(squiggleEventHandler);
            camera.AddInputEventListener(squiggleEventHandler);

            // remove default event handlers, not really nessessary since the squiggleEventHandler
            // consumes everything anyway, but still good to do.
            //Canvas.RemoveInputEventListener(Canvas.PanEventHandler);
            Canvas.RemoveInputEventListener(Canvas.ZoomEventHandler);

            PNode sharedNode = new SharedNode(lens);

            sharedNode.Brush = new SolidBrush(Color.Green);             // Brushes.Green;
            sharedNode.SetBounds(0, 0, 100, 200);
            sharedNode.TranslateBy(100, 220);
            sharedLayer.AddChild(sharedNode);

            PText label = new PText("Move the lens \n (by dragging title bar) over the green rectangle, and it will appear red. press and drag the mouse on the canvas and it will draw squiggles. press and drag the mouse over the lens and drag squiggles that are only visible through the lens.");

            label.Font = new Font("Arial", 10, FontStyle.Regular);
            label.ConstrainWidthToTextWidth = false;
            label.SetBounds(100, 70, 130, 200);

            sharedLayer.AddChild(label);

            base.Initialize();
        }
Beispiel #4
0
        public override void Initialize()
        {
            PNode layoutNode = new LayoutNode();

            layoutNode.Brush = Brushes.Red;

            // add some children to the layout node.
            for (int i = 0; i < 100; i++)
            {
                // create child to add to the layout node.
                PNode each = PPath.CreateRectangle(0, 0, 100, 80);

                // add the child to the layout node.
                layoutNode.AddChild(each);
            }

            PBoundsHandle.AddBoundsHandlesTo(layoutNode.GetChild(0));

            // add layoutNode to the root so it will be displayed.
            Canvas.Layer.AddChild(layoutNode);
        }
Beispiel #5
0
        public override void Initialize()
        {
            PLayer l = new PLayer();
            PPath  n = PPath.CreateEllipse(0, 0, 100, 80);

            n.Brush = Brushes.Red;
            n.Pen   = null;
            PBoundsHandle.AddBoundsHandlesTo(n);
            l.AddChild(n);
            n.TranslateBy(200, 200);

            PCamera c = new PCamera();

            c.SetBounds(0, 0, 100, 80);
            c.ScaleViewBy(0.1f);
            c.AddLayer(l);
            PBoundsHandle.AddBoundsHandlesTo(c);
            c.Brush = Brushes.Yellow;

            Canvas.Layer.AddChild(l);
            Canvas.Layer.AddChild(c);
        }
Beispiel #6
0
        public override void Initialize()
        {
            PPath n = PPath.CreateRectangle(0, 0, 100, 80);

            // add another node the the root as a reference point so that we can
            // tell that our node is getting dragged, as opposed the the canvas
            // view being panned.
            Canvas.Layer.AddChild(PPath.CreateRectangle(0, 0, 100, 80));

            Canvas.Layer.AddChild(n);

            // tell the node to show its default handles.
            PBoundsHandle.AddBoundsHandlesTo(n);

            // The default PBoundsHandle implementation doesn't work well with PPaths that have strokes. The reason
            // for this is that the default PBoundsHandle modifies the bounds of an PNode, but when adding handles to
            // a PPath we really want it to be modifying the underlying geometry of the PPath, the shape without the
            // stroke. The solution is that we need to create handles specific to PPaths that locate themselves on the
            // paths internal geometry, not the external bounds geometry...

            n.Pen   = new Pen(Color.Black, 10);
            n.Brush = Brushes.Green;

            // Here we create our own custom handle. This handle is located in the center of its parent
            // node and you can use it to drag the parent around. This handle also updates its color when
            // the is pressed/released in it.
            PHandle h = new PathHandle(new PNodeLocator(n));

            h.AddInputEventListener(new HandleEventHandler(h));

            // make this handle appear a bit different then the default handle appearance.
            h.Brush = Brushes.Red;
            h.SetBounds(-10, -10, 20, 20);

            // also add our new custom handle to the node.
            n.AddChild(h);
        }
Beispiel #7
0
        public override void Initialize()
        {
            PLayer   l = new PLayer();
            PEllipse n = new PEllipse();

            n.SetBounds(0, 0, 100, 80);
            n.Brush = new SolidBrush(Color.Red);
            PBoundsHandle.AddBoundsHandlesTo(n);
            l.AddChild(n);
            n.TranslateBy(100, 100);

            PCamera c = new PCamera();

            c.SetBounds(0, 0, 100, 80);
            c.ScaleViewBy(0.1f);
            c.AddLayer(l);
            PBoundsHandle.AddBoundsHandlesTo(c);
            c.Brush = new SolidBrush(Color.Yellow);

            Canvas.Layer.AddChild(l);
            Canvas.Layer.AddChild(c);

            base.Initialize();
        }
 /// <summary>
 /// Removes bounds handles from the given node.
 /// </summary>
 /// <param name="node">The node to undecorate.</param>
 public virtual void UndecorateSelectedNode(PNode node)
 {
     PBoundsHandle.RemoveBoundsHandlesFrom(node);
 }
 /// <summary>
 /// Adds bounds handles to the given node.
 /// </summary>
 /// <param name="node">The node to decorate.</param>
 public virtual void DecorateSelectedNode(PNode node)
 {
     PBoundsHandle.AddBoundsHandlesTo(node);
 }