Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how to select a shape that covered by a transparent shape without moving this transparent shape? (Read 3977 times)
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
how to select a shape that covered by a transparent shape without moving this transparent shape?
Feb 18th, 2014 at 10:24pm
Print Post  
how to select a shape that covered by a transparent shape without moving this transparent shape?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to select a shape that covered by a transparent shape without moving this transparent shape?
Reply #1 - Feb 19th, 2014 at 12:38pm
Print Post  
Set the transparent node's Locked property.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to select a shape that covered by a transparent shape without moving this transparent shape?
Reply #2 - Feb 20th, 2014 at 7:42am
Print Post  
If you don't want to lock the transparent node, that's actually a good application of behavior classes we discussed earlier. The following StartDraw overload will let you move an opaque node behind a transparent one, or move the transparent node if it's the only one at that location.

Code
Select All
public override InteractionState StartDraw(PointF point)
{
	var nodes = DiagramView.Diagram.GetNodesAt(point);
	foreach (var node in nodes)
	{
		var shapeNode = node as ShapeNode;
		if (shapeNode != null && shapeNode.Transparent)
			continue;
		var handle = node.HitTestHandle(point);
		if (handle != null)
			return new InteractionState(node, handle, Action.Modify);
	}
	return base.StartDraw(point);
} 



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: how to select a shape that covered by a transparent shape without moving this transparent shape?
Reply #3 - Feb 20th, 2014 at 5:40pm
Print Post  
Thanks, I will try this.
  
Back to top
 
IP Logged
 
CanadaProgrammer
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 113
Joined: Jun 30th, 2011
Re: how to select a shape that covered by a transparent shape without moving this transparent shape?
Reply #4 - Jun 19th, 2014 at 11:01pm
Print Post  
Thanks, it can work. But when I set Transparent property to true, whole shape is transparent include border. I want border is visible what is the easy way to do it?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to select a shape that covered by a transparent shape without moving this transparent shape?
Reply #5 - Jun 20th, 2014 at 7:35am
Print Post  
Set shape.Brush = new SolidBrush(Color.Transparent); You'd probably want to set the same value for ShadowBrush, if you haven't disabled shadows altogether. Then check the Brush.Color value instead of Transparent property when hit-testing in code above.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint