Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ShapeNode Transparency (Read 4136 times)
mafpinedo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Jun 7th, 2010
ShapeNode Transparency
Jul 21st, 2010 at 10:42am
Print Post  

Hello,

i would like to know if it's possible to have a ShapeNode where i can set the Background Color of the ShapeNode to a Transparent Color.

I tried setting the ShapeNode.Transparent to true, but this skip the background paint.

I tried also setting the ShapeNode.Transparent and create an image with the Transparent color and after set the ShapeNode.Image = transparentColorImage

Non of these worked for me.

THanks in advance.
Regards.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeNode Transparency
Reply #1 - Jul 21st, 2010 at 11:18am
Print Post  
Hi,

Set the node's Brush to a SolidBrush or GradientBrush whose Color.Alpha values are < 255.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mafpinedo
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Jun 7th, 2010
Re: ShapeNode Transparency
Reply #2 - Jul 21st, 2010 at 12:30pm
Print Post  
Sorry, i tested but the Box is not transparent yet.

Another related question.

I want a ShapeNode, where the backColor will be Transparent, but i need that the border will be drawn anyway.

Then, i set the ShapeNode.Transparent to True.

And after, what i´m doing is creating a Bitmap from Graphics calling DrawRectangle (where the pen is black) and set this Image as the ShapeNode.Image.

The ShapeNode keeps without draw the border.

What am i wrong?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeNode Transparency
Reply #3 - Jul 21st, 2010 at 1:12pm
Print Post  
Perhaps you are seeing the shadow drawn behind, try setting ShadowBrush to null to disable it.

ShapeNode.Transparent always hides the border. You will have to set Brush to an instance whose Color is set to Color.Tranparent to leave the border visible but hide the interior.

Stoyan
  
Back to top
 
IP Logged
 
SCooper
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Aug 10th, 2010
Re: ShapeNode Transparency
Reply #4 - Aug 10th, 2010 at 7:49am
Print Post  
Hi, am I am co-worker with mafpinedo, working on the same issue with transparency.

We have tried as you suggested keeping ShapeNode.Transparent to false and setting the Brush colour to Transparent instead. This however rather than making the node transparent, renders the node as a dark grey with no visible text.

Is there something else we should be doing in order to have a transparent shape node, with a visible boarder and text ?

Many thanks,
Steve
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeNode Transparency
Reply #5 - Aug 10th, 2010 at 8:05am
Print Post  
Have you also set ShadowBrush to null (or in older releases - ShadowColor to Transparent)?

node.ShadowBrush = null;
node.Brush = new SolidBrush(Color.Transparent);
node.Text = "test";

The code above applied on the lower two nodes:
  
Back to top
 
IP Logged
 
SCooper
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Aug 10th, 2010
Re: ShapeNode Transparency
Reply #6 - Aug 10th, 2010 at 9:29am
Print Post  
Thank you, we are going to try that now. One more issue has come up that we do not understand. We are trying use custom drawing for some of the ShapeNodes but it is not working as we expected.

We have set the flowChart.ShapeCustomDraw = CustomDraw.Additional2. In the ShapeNode we have also set the ShapeNode.CustomDraw = CustomDraw.Full.

We have set a breakpoint in our callback for the DrawNode event, but it never hits. If we change the ShapeNode to something other than Full then the breakpoint hits.

How are we supposed to use the CustomDraw.Full option? Is there another event that activates?

Thanks for any help,
Steve
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeNode Transparency
Reply #7 - Aug 10th, 2010 at 10:44am
Print Post  
What does your event handler look like? This works fine in my test:

Code
Select All
node.CustomDraw = CustomDraw.Full;
diagram.DrawNode += new DrawNodeEventHandler(diagram_DrawNode);

private void diagram_DrawNode(object sender, DrawNodeEventArgs e)
{
	if (!e.Shadow)
		e.Graphics.DrawRectangle(Pens.Black, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
} 

  
Back to top
 
IP Logged
 
SCooper
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Aug 10th, 2010
Re: ShapeNode Transparency
Reply #8 - Aug 10th, 2010 at 12:48pm
Print Post  
Hi, good news, the transparency issue has been resolved, it was indeed the shadow causing our headaches.

Also, a left over ShapeNode.Transparent = true; was causing the DrawNode event not to fire when it was set to Full.

Many thanks for all the help,
Steve
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint