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 = Brushes.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 Point(this.Location.X + this.Width, this.Location.Y);
			result.Size = this.Size;
			result.Show();
		}
Пример #2
0
        /// <summary>
        /// Creates active new PStyledText containing specific text
        /// </summary>
        /// <param name="startText">The text the PStyledText should start with</param>
        /// <param name="form">The form that the PStyledText'start Model should attatch itself to</param>
        public PStyledText(string startText, PForm form)
        {
            Form = form;

            //Add the model & required handles
            Model = new Model(this, startText);

            Model.TextChanged += Model_TextChanged;
            Model.SelectionChanged += Model_SelectionChanged;
            Model.GotFocus += Model_GotFocus;
            Model.LostFocus += Model_LostFocus;
            Model.KeyDown += Model_KeyDown;
            //Add the Model to the Form so that it can take focus
            Form.Controls.Add(Model);

            //Add Selection events
            AddInputEventListener(SelectHandler);
            ChangeSelection += OnChangeSelection;
            ConfirmSelection += OnConfirmSelection;

            //Set default values
            ConstrainWidthToTextWidth = false;
            Editable = true;
        }
Пример #3
0
		public override void Initialize() {
			// Add a standard pnode to the scene graph.
			PNode aNode = new PNode();
			aNode.SetBounds(0, 70, 15, 15);
			aNode.Brush = Brushes.Blue;
			Canvas.Layer.AddChild(aNode);

			// Create a button.
			Button button = new Button();
			button.Text = "Hello";
			button.Bounds = new Rectangle(10, 10, 10, 10);
			button.BackColor = SystemColors.Control;

			// Wrap the button in a PControl and
			// add it to the scene graph.
			PControl cn = new PControl(button);
			Canvas.Layer.AddChild(cn);
			cn.SetBounds(20, 20, 70, 70);

			// Create another button.
			Button otherButton = new Button();
			otherButton.Text = "123";
			otherButton.Bounds = new Rectangle(0, 0, 15, 45);
			otherButton.BackColor = SystemColors.Control;

			// Wrap the second button in another PControl and
			// add it to the scene graph.
			PControl cn2 = new PControl(otherButton, PCanvas.CURRENT_PCANVAS);
			cn2.ScaleBy(1.1f);
			Canvas.Layer.AddChild(cn2);

			// Create a tabcontrol
			TabControl tabControl = new TabControl();
			tabControl.Size = new Size(60, 60);
			tabControl.TabPages.Add(new TabPage("P1"));
			tabControl.TabPages.Add(new TabPage("P2"));

			// Wrap the tabcontrol in a PControl and
			// add it the scene graph.
			PControl cn3 = new PControl(tabControl);
			cn3.ScaleBy(1.2f);
			cn3.TranslateBy(0, 100);
			Canvas.Layer.AddChild(cn3);

			// Create an internal camera that looks at the main layer.
			PCamera internalCamera = new PCamera();
			internalCamera.TranslateViewBy(145, 145);
			internalCamera.ScaleViewBy(.5f);
			internalCamera.SetBounds(130, 130, 200, 200);
			internalCamera.Brush = Brushes.Yellow;
			internalCamera.AddLayer(Canvas.Layer);
			Canvas.Camera.AddChild(internalCamera);

			Canvas.Layer.ScaleBy(1.3f);

			// Create another canvas.
			PCamera otherCamera = new PCamera();
			otherCamera.AddLayer(Canvas.Layer);
			Canvas.Root.AddChild(otherCamera); 	
		
			PCanvas other = new PCanvas();
			other.Camera = otherCamera;
			PForm result = new PForm(false, other);
			result.StartPosition = FormStartPosition.Manual;
			result.Location = new Point(this.Location.X + this.Width, this.Location.Y);
			result.Size = this.Size;
			result.Show();

			// Add the control event handler to both canvas' cameras.
			Canvas.Camera.AddInputEventListener(new PControlEventHandler());
			other.Camera.AddInputEventListener(new PControlEventHandler());
		}
Пример #4
0
 /// <summary>
 /// Creates active new, empty PStyledText
 /// </summary>
 /// <param name="form">The form that the PStyledText'start Model should attatch itself to</param>
 public PStyledText(PForm form) : this("", form) { }