/// <summary> /// When the user types, create a new document and put the input inside of it /// </summary> public override void OnKeyPress(object sender, PInputEventArgs e) { base.OnKeyPress(sender, e); //Only fire if it isn't a control character if (e.KeyChar >= ' ' && e.KeyChar <= '~') { //Create the document in the last clicked location float x = LastPoint.X; float y = LastPoint.Y; Document created = new Document(x, y, e.KeyChar, (Window)Owner.FindForm()); Owner.Layer.AddChild(created); //Shift the keyboard focus to the newly created document PStyledText firstPage = created.Pages[0]; e.InputManager.KeyboardFocus = firstPage.ToPickPath(e.Camera, firstPage.Bounds); } }
/// <summary> /// Sets the current selection of a PStyledText to the current style /// </summary> /// <param name="target"></param> public void ApplyStyle(PStyledText target) { ApplyStyle(target.Model); }