How do I change the shape in code

Apr 27, 2011 at 9:26 AM

Hi All, I have tried for hours to figure out how to change the shape of an element in the treeview example from the default to anything in the BasicStencilType enum but to no avail

surely it is really simple can someone out there please advise.

this is what I would like to do

shape = new Shape(BasicStencilType 

.Circle);

shape.Location = new PointF 

(400, 200);

model.Shapes.Add("b2" 

, shape);
 

 

 

 

 

 

public enum BasicStencilType {

Rectangle = 0,

RoundedRectangle = 1,

Ellipse = 2,

Circle = 3,

Diamond = 4,

TopTriangle = 5,

BottomTriangle = 6,

LeftTriangle = 7,

RightTriangle = 8,

Octagon = 9

}

 

Regards

Marshall Brown

Developer
Apr 27, 2011 at 11:52 AM

Hi.

It seems you are passing the correct parameters. You are sending an enumerated value instead of a StencilItem. Try replacing your code with this:

BasicStencil _bs = new BasicStencil ( );

shape = new Shape ( _bs [ BasicStencilType.Circle ] );
shape.Location = new PointF(400, 200);
model.Shapes.Add("b2", shape);

Apr 27, 2011 at 6:37 PM

That worked a treat, thank you so much...

 

Regards

Marshall