Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Require Colored Transparancy in ShapeNode (Read 5797 times)
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Require Colored Transparancy in ShapeNode
Sep 18th, 2009 at 10:38am
Print Post  
Hi Stoyan,

We want to create a shapenode with following functionality.

1) Node should be resizable.
2) Node should have Image and Text.
3) Text should be inside the node at BottomCenter position.
4) Text should have a icon associate with it at topright corner.
5) Node should be transparent but should have some shade of gray color.
6) Node's transparency should not have any effect on text and image.


Thanks,
Anshul


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require Colored Transparancy in ShapeNode
Reply #1 - Sep 18th, 2009 at 2:31pm
Print Post  
It should be enough to set node.Brush to one that has semi-transparent colors, e.g.

node.Brush = new SolidColorBrush(Color.FromArgb(80, 128, 128, 128));

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require Colored Transparancy in ShapeNode
Reply #2 - Sep 22nd, 2009 at 12:04pm
Print Post  
Hi Stoyan,

We have sent sample images to your support ID. Please have a look into them.

Please suggest how to get the required Shape.

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require Colored Transparancy in ShapeNode
Reply #3 - Sep 22nd, 2009 at 3:11pm
Print Post  
Hi Anshul,

Try these settings:

Code
Select All
var format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Far;
format.FormatFlags = StringFormatFlags.NoWrap;

var node = diagram.Factory.CreateShapeNode(30, 30, 80, 50);
node.EnableStyledText = true;
node.PolygonalTextLayout = false;
node.TextFormat = format;
node.ClipToBounds = true;
node.Text = "test test test test test";
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require Colored Transparancy in ShapeNode
Reply #4 - Sep 23rd, 2009 at 6:07am
Print Post  
Hi Stoyan,

Many thanks for the code snippet.

With this implementation, we are still facing two issues.

1). We need text trimming when text is long(Text length is greater than the node width).

2). Text should have some spacing from the bottom; currently it is touching the node border.

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require Colored Transparancy in ShapeNode
Reply #5 - Sep 23rd, 2009 at 7:17am
Print Post  
Have you set node.ClipToBounds = true? You could define a custom Shape with a smaller text area to move the text further from the border.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require Colored Transparancy in ShapeNode
Reply #6 - Sep 23rd, 2009 at 8:32am
Print Post  
yes I have set node.ClipToBounds = true but still text is not trimming.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require Colored Transparancy in ShapeNode
Reply #7 - Sep 23rd, 2009 at 9:46am
Print Post  
It seems if I enable ModificationEffect = MoveShades, the drawing shown at the original location while moving a node does not trim the text. Is this what you mean?
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require Colored Transparancy in ShapeNode
Reply #8 - Sep 23rd, 2009 at 10:33am
Print Post  
I have not set ModificationEffect = MoveShades still I am getting the problem. Please suggest how can I Trim the text ?

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require Colored Transparancy in ShapeNode
Reply #9 - Sep 23rd, 2009 at 1:17pm
Print Post  
Could you copy here the initialization code for the node?
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require Colored Transparancy in ShapeNode
Reply #10 - Sep 23rd, 2009 at 1:32pm
Print Post  
Hi Stoyan,

Here is the code snippet

Code
Select All
ShapeNode mainNode = new ShapeNode(diagram);


Font nodeFont = new Font("Calibri", 12);
mainNode.Font = nodeFont;
mainNode.TextFormat.Alignment = StringAlignment.Center;
mainNode.TextFormat.LineAlignment = StringAlignment.Center;
mainNode.TextFormat.Trimming = StringTrimming.EllipsisCharacter;

var format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Far;
format.FormatFlags = StringFormatFlags.NoWrap;
format.Trimming = StringTrimming.EllipsisCharacter;
mainNode.EnableStyledText = true;
mainNode.PolygonalTextLayout = false;
mainNode.TextFormat = format;
mainNode.ClipToBounds = true;

mainNode.HandlesStyle = HandlesStyle.SquareHandles | HandlesStyle.EasyMove;
mainNode.EnabledHandles = AdjustmentHandles.ResizeHandles | AdjustmentHandles.Move;
diagram.Nodes.Add(mainNode);

mainNode.Shape = Shapes.Rectangle;
mainNode.Bounds = new Rect(new Point(50,50,50,50);
mainNode.Brush = new SolidColorBrush(Color.FromArgb(95, 211, 211, 211));
mainNode.Pen = new Pen(new SolidColorBrush(Color.FromRgb(189,186,105)),1);

mainNode.Image = new BitmapImage(new Uri(@"..\..\Image.png", UriKind.RelativeOrAbsolute))
mainNode.ImageAlign = ImageAlign.TopLeft;
mainNode.Text = “Its not Trimming”;
mainNode.TextBrush = Brushes.Black;
 



Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Require Colored Transparancy in ShapeNode
Reply #11 - Sep 24th, 2009 at 8:56am
Print Post  
You might change mainNode.TextFormat.Alignment to StringAlignment.Near. Other than that, the text is clipped but does not display an ellipsis. We'll add some support for this and a text-margins property in a few days.

Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Require Colored Transparancy in ShapeNode
Reply #12 - Oct 13th, 2009 at 1:03pm
Print Post  
Hi Stoyan,
Any update on this?

Regards,
Anshul
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint