Пример #1
0
        public override void Initialize()
        {
            // Create a green and red node and add them to canvas layer.
            PCanvas canvas    = Canvas;
            PNode   nodeGreen = PPath.CreateRectangle(0, 0, 100, 100);
            PNode   nodeRed   = PPath.CreateRectangle(0, 0, 100, 100);

            nodeRed.TranslateBy(200, 0);
            nodeGreen.Brush = Color.Green;
            nodeRed.Brush   = Color.Red;
            canvas.Layer.AddChild(nodeGreen);
            canvas.Layer.AddChild(nodeRed);

            nodeGreen.AddInputEventListener(new GreenInputEventListener());
            nodeRed.AddInputEventListener(new RedInputEventListener());

            // Or, delegates could be used to add each eventhandler such as
            // nodeGreen.MouseDown += new PInputEventHandler(nodeGreen_MouseDown);
            // However, overriding the PBasicInputEventHandler is the preferred
            // approach
        }