static void Main(string[] args) { // Suppose that our client needs to get a TextShape and then get its BoundingBox as well as the manipulator. // Bacause the needed methods are adapted from the ones existing in TextView library, we must pass a TextView instance to the adapter. var TextShape = new TextShape(new TextView()); if (!TextShape.IsEmpty()) { Console.WriteLine("Here is the bounding rect for out text shape:\n" + $"bottom-left coordinates: {TextShape.BoundingBox().bottomLeft.X}, {TextShape.BoundingBox().bottomLeft.Y}\n" + $"top-right coordinates: {TextShape.BoundingBox().topRight.X}, {TextShape.BoundingBox().topRight.Y}"); } IManipulator manipulator; try { manipulator = TextShape.CreateManipulator(); Console.WriteLine("Successfully get the text shape manipulator."); } catch { Console.WriteLine("Error occurred while creating the text shape manipulator."); throw; } }
static void Main(string[] args) { Target target = new Adapter1.Adapter(); target.Request(); Shape shape = new TextShape(); string text = shape.BoundingBox(); }
static void Main(string[] args) { Shape textShape = new TextShape(0, 0, 10, 15); Point bottomLeft = new Point(); Point topRight = new Point(); textShape.boundingBox(bottomLeft, topRight); Console.WriteLine("Bottom left (x, y): " + bottomLeft.x + " " + bottomLeft.y); Console.WriteLine("Top right (x, y): " + topRight.x + " " + topRight.y); textShape.createManipulator(); }
static void Main(string[] args) { //画线调用 Shape line = new Line(); line.BoundingBox(); line.CreateManipulator().Move(); Console.WriteLine("——————————"); //文本编辑调用 Shape editor = new TextShape(); editor.BoundingBox(); editor.CreateManipulator().Move(); Console.ReadLine(); }
public TextManipulator(TextShape shape) { this.shape = shape; }