Group: Forum Members
Last Active: 12 Years Ago
Posts: 5,
Visits: 1
|
Here it is: (You can convert these code to inherit from NEllipseShape)
public class NFaiencePolygonShape: NPolygonShape { #region CTors
public NFaiencePolygonShape() { }
public NFaiencePolygonShape(NPointF[] points): base(points) {
}
public NFaiencePolygonShape(NPolygonPath primitive): base(primitive) {
}
#endregion
#region Properties
private string _Key = Guid.NewGuid().ToString(); public string Key { get { return _Key; } }
public int XPFaienceId { get; set; } public FaienceDisplayMode FaienceDisplayMode { get; set; } public bool AutoDecorate { get; set; } public float DerzWidth { get; set; } public float OffsetX { get; set; } public float OffsetY { get; set; } public float RotationAngle { get; set; }
public Color DerzColor { get; set; } public float Tracker { get; set; } public int TamFayansCount { get; set; } public int BrokenFayansCount { get; set; }
#endregion }
public class NCreateFaiencePolygonTool : NCreatePolygonTool { protected override Nevron.Diagram.INDiagramElement CreateElement(bool preview) { NFaiencePolygonShape shape = new NFaiencePolygonShape(); shape.InteractionStyle = new Nevron.Diagram.NInteractionStyle() { GeometryPoints = true, PinPoint = true, RotatedBounds = true, Rotation = true, Bounds = false }; return shape; }
}
usage is like :
nDrawingView.Controller.Tools.Add(new NCreateFaiencePolygonTool() { Name = "FaiencePolygonTool" });
To set current tool:
nDrawingView.Controller.Tools.SingleEnableTools(new string["FaiencePolygonTool"]);
Hope this helps
|
Group: Forum Members
Last Active: 10 Years Ago
Posts: 15,
Visits: 1
|
I am using NDrawingDiagram to create different shapes based on an external database. I am able to programmatically place a custom shape on to the drawingview without any issues. I am not currently using a library for these custom shapes and I would really prefer to avoid this option. All of my custom shapes are currently NGroups. I do not want users to be able to place Ellipses onto the drawingview and have overridden the NEnableCreateEllipseToolCommand with my own Command. I am wondering if this is the right way to go about this or should I create my own custom Tool with a corresponding Enable command?
Here is my current code.
using System.Linq; using System.Text; using Nevron; using Nevron.Diagram.WinForm.Commands; using Nevron.UI;
namespace Elixir.App.FormatDesigner { public class EnableCreateBarcodeCommand : NEnableCreateEllipseToolCommand {
public EnableCreateBarcodeCommand() : base() { base.Text = "Barcode Tool"; base.TooltipText = "Barcode Tool"; }
public override void Execute() { base.Execute(); }
} }
|