Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Need Custom Position for Node's Text (Read 2441 times)
Bala
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 156
Joined: Apr 21st, 2009
Need Custom Position for Node's Text
Jun 5th, 2009 at 6:43am
Print Post  
Hi Stoyan,

I have sent an image at your support mail-id, problem discription is also written their.Please have a look into that and give us the possible solution.

Thanks,
Bala
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Need Custom Position for Node's Text
Reply #1 - Jun 5th, 2009 at 9:28am
Print Post  
Hi Bala,

Quote:
Node's text should start from just beside the image (as in fig3) but if text is long enough, it should be truncated (as in fig 2).


You could use a TableNode with two cells, the first cell displaying the image and the second one displaying the text. If you prefer using ShapeNodes, try the following Shape definition.

Code
Select All
var textOnTheRight = new Shape(
	Shapes.Rectangle.Outline,// reuse the rectangular shape
	null,// no decorations
	new ElementTemplate[]// define text region
	{
		new LineTemplate(20, 0, 100, 0),
		new LineTemplate(100, 0, 100, 100),
		new LineTemplate(100, 100, 20, 100),
		new LineTemplate(20, 100, 20, 0)
	},
	FillRule.EvenOdd,// doesn't matter here
	"TextOnTheRight"// to access the shape later using Shape.FromId
);
textOnTheRight.ImageRectangle = new Rect(0, 0, 20, 20);
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Need Custom Position for Node's Text
Reply #2 - Jun 5th, 2009 at 9:35am
Print Post  
To align the text to the left:

Code
Select All
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Near;
node.TextFormat = format;
 

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Need Custom Position for Node's Text
Reply #3 - Jun 5th, 2009 at 9:40am
Print Post  
Quote:
I am getting a dirty border while selecting the node. I want a smooth border. How I can get this?


In the DrawAdjustmentHandles event handler, remove the hatchBrush and draw the selection rectangle using a solid-color pen.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Need Custom Position for Node's Text
Reply #4 - Jun 5th, 2009 at 10:16am
Print Post  
Quote:
I have attached a expand node inside this main node. But I get a dull + button on startup, Once you click on that button it gets clearly visible. Why it is so dull until I click on that.


Because WPF renders images blurred when they are not aligned to device pixels. The collapse/expand button has some code that aligns the image to the nearest device pixel when it is rendered, and it runs after click, so the +/- icon becomes more sharp. I suppose they appear blurred initially because of your scroll and zoom code at startup.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint