protected override void OnInitialize() { base.OnInitialize(); var rect1 = new Rectangle(100, 100, 100, 100) { FillColor = Colors.Chocolate }; rect1.InstallEditPolicy(SelectionFeedbackPolicy); rect1.AddHandlesCornerDirections(Canvas, HandleSizes.Medium, HandleShapeType.Round); Canvas.AddFigure(rect1); var rect2 = new Rectangle(400, 100, 100, 100) { FillColor = Colors.DarkGreen }; rect2.InstallEditPolicy(SelectionFeedbackPolicy); rect2.AddHandlesCornerDirections(Canvas, HandleSizes.Medium, HandleShapeType.Round); Canvas.AddFigure(rect2); var rect3 = new Rectangle(200, 300, 100, 100) { FillColor = Colors.DarkRed }; rect3.InstallEditPolicy(SelectionFeedbackPolicy); rect3.AddHandlesCornerDirections(Canvas, HandleSizes.Medium, HandleShapeType.Round); Canvas.AddFigure(rect3); }
protected override void OnInitialize() { base.OnInitialize(); var visiblePolicyRect = new Rectangle(0, 0, 500, 500); visiblePolicyRect.FillColor = Colors.CornflowerBlue; visiblePolicyRect.IsDragable = true; visiblePolicyRect.IsSelectable = true; var regionPolicy = new FigureRegionDragDropEditPolicy(visiblePolicyRect); Canvas.AddFigure(visiblePolicyRect); var rect1 = new Rectangle(10, 10, 100, 100) { FillColor = Colors.LightCoral }; rect1.AddHandlesCornerDirections(Canvas, HandleSizes.Small, HandleShapeType.Round); rect1.InstallEditPolicy(regionPolicy); rect1.InstallEditPolicy(SelectionFeedbackPolicy); visiblePolicyRect.InstallEditPolicy(new MasterSlaveDragDropPolicy(rect1)); Canvas.AddFigure(rect1); //var rect2 = new Rectangle(100, 100, 100, 100) //{ // FillColor = Colors.LightSeaGreen //}; //rect2.AddHandlesCornerDirections(Canvas, HandleSizes.Small, HandleShapeType.Round); //rect2.InstallEditPolicy(SelectionFeedbackPolicy); //Canvas.AddFigure(rect2); }
protected override void OnInitialize() { base.OnInitialize(); var rect1 = new Rectangle(100, 100, 100, 100); var resizeHandleTop = new ResizeHandle(rect1, new Ellipse(0, 0, 30, 30) { FillColor = Colors.Red.AdjustOpacity(0.5) }, 0, 0, ResizeDirections.Top); resizeHandleTop.InstallEditPolicy(new SnapGridPolicy()); rect1.AddHandle(resizeHandleTop); rect1.InstallEditPolicy(SelectionFeedbackPolicy); rect1.InstallEditPolicy(new DragFeedbackPolicy()); Canvas.AddFigure(rect1); var rect2 = new Rectangle(250, 100, 100, 100); rect2.AddHandle(new ResizeHandle(rect2, new Ellipse(0, 0, 30, 30), 0, 0, ResizeDirections.Top)); rect2.AddHandle(new ResizeHandle(rect2, new Ellipse(0, 0, 30, 30), 0, 0, ResizeDirections.Left)); rect2.InstallEditPolicy(SelectionFeedbackPolicy); Canvas.AddFigure(rect2); var rect3 = new Rectangle(400, 100, 100, 100); rect3.AddHandlesCornerDirections(Canvas, HandleSizes.Big, HandleShapeType.Round); rect3.InstallEditPolicy(SelectionFeedbackPolicy); Canvas.AddFigure(rect3); var rect4 = new Rectangle(100, 300, 100, 100); rect4.AddHandlesLeftRightDirections(Canvas, HandleSizes.Medium, HandleShapeType.Square); rect4.InstallEditPolicy(SelectionFeedbackPolicy); Canvas.AddFigure(rect4); var rect5 = new Rectangle(250, 300, 100, 100); rect5.AddHandlesAllDirections(Canvas, HandleSizes.Medium, HandleShapeType.Square); rect5.InstallEditPolicy(SelectionFeedbackPolicy); Canvas.AddFigure(rect5); var rect6 = new Rectangle(400, 300, 100, 100); rect6.AddHandlesLeftRightDirections(Canvas, HandleSizes.Medium, HandleShapeType.Square); rect6.AddHandlesTopBottomDirections(Canvas, HandleSizes.Medium, HandleShapeType.Round); rect6.InstallEditPolicy(SelectionFeedbackPolicy); Canvas.AddFigure(rect6); }
protected override void OnInitialize() { base.OnInitialize(); Canvas.CoordinateSystem = new CartesianCoordinateSystem(Canvas.Width / 2, Canvas.Height / 2); var rect1 = new Rectangle(0, 0, 100, 100) { FillColor = Colors.CornflowerBlue, StrokeColor = Colors.Coral, StrokeThickness = 8 }; rect1.AddHandlesCornerDirections(Canvas, HandleSizes.Small, HandleShapeType.Round); rect1.InstallEditPolicy(SelectionFeedbackPolicy); Canvas.AddFigure(rect1); var rect2 = new Rectangle(250, 100, 100, 100) { FillColor = Color.FromArgb(100, 100, 170, 80) }; rect2.AddHandlesCornerDirections(Canvas, HandleSizes.Small, HandleShapeType.Round); rect2.InstallEditPolicy(SelectionFeedbackPolicy); Canvas.AddFigure(rect2); var ellipse2 = new Ellipse(100, 300, 100, 100) { FillColor = Colors.Transparent }; ellipse2.AddHandlesCornerDirections(Canvas, HandleSizes.Small, HandleShapeType.Round); ellipse2.InstallEditPolicy(SelectionFeedbackPolicy); Canvas.AddFigure(ellipse2); var ellipse3 = new Ellipse(250, 300, 100, 100); ellipse3.FillColor = Colors.Brown; ellipse3.AddHandlesCornerDirections(Canvas, HandleSizes.Small, HandleShapeType.Round); ellipse3.InstallEditPolicy(SelectionFeedbackPolicy); Canvas.AddFigure(ellipse3); }
protected override void OnInitialize() { base.OnInitialize(); var regionPolicy = new RegionDragDropEditPolicy(new Draw2D.Core.Geo.Rectangle(0, 0, Canvas.Width, Canvas.Height)); var rect1 = new Rectangle(100, 100, 100, 100); rect1.AddHandlesCornerDirections(Canvas, HandleSizes.Small, HandleShapeType.Round); rect1.InstallEditPolicy(SelectionFeedbackPolicy); rect1.InstallEditPolicy(regionPolicy); Canvas.AddFigure(rect1); var text1 = new BoxedText("I'm a slave of the rect.\nNo selection feedback policy installed.", rect1.X + 10f, rect1.Y + 10f, 150, 30); rect1.InstallEditPolicy(new MasterSlaveDragDropPolicy(text1)); Canvas.AddFigure(text1); var text2 = new BoxedText("I'm a slave of the rect.\nSelection feedback policy installed.", rect1.X + 10, rect1.Y + 110, 150, 30); text2.InstallEditPolicy(SelectionFeedbackPolicy); rect1.InstallEditPolicy(new MasterSlaveDragDropPolicy(text2)); Canvas.AddFigure(text2); }
protected override void OnInitialize() { base.OnInitialize(); var message = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."; var xCount = 300; var yCount = 300; Canvas.Width = xCount * 150 + 100; Canvas.Height = yCount * 150 + 100; Canvas.StartBulkEdit(); for (int i = 0; i < xCount; i++) { for (int j = 0; j < yCount; j++) { var rect1 = new Rectangle(i * 150, j * 150, 100, 100) { FillColor = Colors.Chocolate }; rect1.InstallEditPolicy(SelectionFeedbackPolicy); rect1.AddHandlesCornerDirections(Canvas, HandleSizes.Medium, HandleShapeType.Round); Canvas.AddFigure(rect1); //var text1 = new BoxedText(message, i * 150, j * 150, 100, 100); //text1.FillColor = Colors.LightSkyBlue; //text1.AddHandlesCornerDirections(Canvas, HandleSizes.Small, HandleShapeType.Round); //text1.InstallEditPolicy(SelectionFeedbackPolicy); //Canvas.AddFigure(text1); } } Canvas.EndBulkEdit(); }