Hello,
i create a custom shape node and add this node to a nodelistview. Now i can drag the node to my diagram.
I select the node and copy and paste it. The node will be copied. New position is in the upper left corner of the diagram. I expect the node with some offset from origin position. What's wrong?
This is the code i create the node:
public class LogicGateNot : ShapeNode
{
public LogicGateNot()
{
InitNode();
}
// Required for creating nodes by dragging them from the NodeListView
public LogicGateNot(LogicGateNot prototype)
: base(prototype)
{
InitNode();
}
private void InitNode()
{
// comment out the next line and copy/paste will work correctly
this.SetBounds(new Rect(0, 0, 100, 100), true, true);
}
public override void Draw(System.Windows.Media.DrawingContext graphics, RenderOptions options)
{
graphics.DrawRectangle(Brushes.Transparent, new Pen(Brushes.Red, 1), new Rect(0, 0, 100, 100));
//base.Draw(graphics, options);
}
}
When i set the width/heigth to 100/100 the error (for me
) occurs. When i comment out the SetBounds function the default width/heigth is 75/75, but this is to small.
Thank you
RunMan