Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Question about UseCase shape (Read 2225 times)
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Question about UseCase shape
May 31st, 2012 at 12:30am
Print Post  
hi,
I can show a UseCase shape. I define a new shape and the base class is ShapeNode.
Right now I want to show the name of UseCase. When user choose and move UseCase shape, the name and shape should be a whole part. I think that I should use combination shape?

Coudl you give me some ideas?

I also try to cusotmize shadow. I found the only way to do this is:
1. override DrawShadow method and do nothing
2. override Draw method, draw shape and shadow together.
Is it the best way to do it?

Thanks a lot.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Question about UseCase shape
Reply #1 - May 31st, 2012 at 6:01am
Print Post  
Hi,

Quote:
Right now I want to show the name of UseCase. When user choose and move UseCase shape, the name and shape should be a whole part. I think that I should use combination shape?


If this name is the only text you need to show for the node, you can use the Text property. If the text should appear at specific position, you could specify it via the ShapeNode.TextPadding or by setting Shape.TextArea.

If the name should be displayed in addition to other text, you could define a Name property in a class derived from ShapeNode, and draw the name from node.Draw override. Alternatively, use an attached node to display the name and set node.Transparent to hide the node's frame and background.

Quote:
I also try to cusotmize shadow. I found the only way to do this is:


For drawing custom shadows, it is best to override DrawShadow and render the shadow there. It's also possible to do this from DrawNode event if you set CustomDraw = ShadowOnly.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: Question about UseCase shape
Reply #2 - Jun 1st, 2012 at 4:21pm
Print Post  
hi Stoyo
Thanks. You gave many great answers.
I override DrawShadow method and do noting. But shadow is still there. I mean when I drawing a new ShapeNode and resize it at that time the shadow is there. When I release left mouse button and finish to draw a new ShapeNode, the shadow is not there.

Thanks again
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: Question about UseCase shape
Reply #3 - Jun 1st, 2012 at 5:30pm
Print Post  
hi

looks ShapeNode does not have a property named TextArea
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Question about UseCase shape
Reply #4 - Jun 4th, 2012 at 7:03am
Print Post  
You aren't calling base.DrawShadow(), are you? This doesn't draw any shadows in my test app:

Code
Select All
public class MyNode : DiagramNode
{
	public MyNode(Diagram diagram)
		: base(diagram)
	{
	}

	public override void Draw(MindFusion.Drawing.IGraphics graphics, RenderOptions options)
	{
		graphics.DrawRectangle(Pens.Black, Rectangle.Truncate(this.Bounds));
	}

	public override void DrawShadow(MindFusion.Drawing.IGraphics graphics, RenderOptions options)
	{
	}
} 



TextArea is property of the Shape class, so you would use it to define text position in all nodes with the same shape. If you need to specify the position for individual nodes, use TextPadding or custom drawing.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint