Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic FlowChart 5.1. Transparent background (Read 7386 times)
SCooper
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Aug 10th, 2010
FlowChart 5.1. Transparent background
Apr 29th, 2011 at 7:58am
Print Post  
Hi,
I'm trying to set the FlowChart background as transparent but I'm getting an exception saying that the control doesn't support transparent background colors.
Is there any other way to make this?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowChart 5.1. Transparent background
Reply #1 - Apr 29th, 2011 at 11:35am
Print Post  
Hi,

Use this class instead:
Code
Select All
public class DiagramViewEx : DiagramView
{
	public DiagramViewEx()
	{
		SetStyle(ControlStyles.SupportsTransparentBackColor, true);
		SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
	}
} 



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


I love YaBB 1G - SP1!

Posts: 12
Joined: Aug 10th, 2010
Re: FlowChart 5.1. Transparent background
Reply #2 - May 3rd, 2011 at 11:37am
Print Post  
Thanks a lot for your quick answer, Stoyo.

I've tryed  your suggestion and the exception is not being thrown anymore, but I can't make the background transparent anyway. When I set the 'DiagramView.Diagram.BackColor' property to 'Color.Transparent' I just get a black background.

This is the code:

           DiagramViewEx diagramView = new DiagramViewEx(new MindFusion.Diagramming.Diagram());

           diagramView.BackColor = Color.Transparent;
           diagramView.Diagram.BackBrush = new MindFusion.Drawing.SolidBrush(Color.Transparent);

The idea is to use the FlowChart as a transparent overlay for other views so you can draw different nodes and relationships as annotations over any other view showing or hiding the overlay as desired.

Any idea?..

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowChart 5.1. Transparent background
Reply #3 - May 3rd, 2011 at 11:55am
Print Post  
I did get black background too in my test without clearing the OptimizedDoubleBuffer flag, but it's transparent with the flag disabled. Version 5.1 might be using the older "DoubleBuffer" flag instead of the "optimized" version, so try clearing DoubleBuffer instead of OptimizedDoubleBuffer.
  
Back to top
 
IP Logged
 
SCooper
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Aug 10th, 2010
Re: FlowChart 5.1. Transparent background
Reply #4 - May 3rd, 2011 at 2:19pm
Print Post  
Hi,

I've tryed clearing the 'DoubleBuffer' flag but I get the same black background. I've even tryed to set other flags as 'UserPaint' to true and 'Opaque' to false, but not success..

More ideas?..

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowChart 5.1. Transparent background
Reply #5 - May 3rd, 2011 at 5:17pm
Print Post  
Check this if you need to show child controls from behind the DiagramView:
http://support.microsoft.com/kb/943454

In my test I used a transparent form and was able to see background windows through the DiagramView. So you might use a second form with transparent DiagramView as an overlay, instead of repainting the background controls as in the KB article.
  
Back to top
 
IP Logged
 
SCooper
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 12
Joined: Aug 10th, 2010
Re: FlowChart 5.1. Transparent background
Reply #6 - May 4th, 2011 at 11:44am
Print Post  
That could solve the visualization issue, but I would need to do something with the events too as they should pass through the transparent areas to the background controls.

What version of FlowChart did you use in your test?..

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowChart 5.1. Transparent background
Reply #7 - May 4th, 2011 at 12:19pm
Print Post  
Quote:
but I would need to do something with the events too as they should pass through the transparent areas to the background controls.


That's not possible in Windows Forms as far as I know, since each control's HWND window cannot pass-through events to the window behind. You can implement that using the WPF version of the diagram control in a WPF app. WinForms-WPF interop will probably not work, because it will introduce a separate window for the diagram control too.

Alternatively in WinForms you could move the controls from your form into the diagram, hosting them in ControlNodes. Then you will be able to draw links between them, and draw annotations using hosted label or textbox controls.

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


I love YaBB 1G - SP1!

Posts: 12
Joined: Aug 10th, 2010
Re: FlowChart 5.1. Transparent background
Reply #8 - May 9th, 2011 at 10:24am
Print Post  
Hi, thanks for the feedback so far.

We have been able to progress by just using a tranparet standard windows form and RTF controls to create the application overlay, but when we add the FlowChart to the form it is drawn with a black background.

We have tried removing the black background when setting both the back colours of the Diagram and DiagramView to be transparent and setting the buffer flags to false as suggested but with no luck.

We found a ShadowColor and ShadowStyle on the diagram which we set also to transparent and the style to None, but this also made no difference.

We're unfortunately getting closer to a deadline and we may have to go with the standard windows controls which would be a shame since FlowChart provides a lot nicer functionality.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FlowChart 5.1. Transparent background
Reply #9 - May 9th, 2011 at 11:08am
Print Post  
You won't be able to pass events to the background controls through a WinForms DiagramView, unless you use a lot of native code to forward messages to the windows behind.

If you want to use the diagram control just for drawing links, perhaps you should move it to the form background behind all other controls. In such case you might have to synchronize the RTF controls in the foreground with some diagram nodes drawn in the diagram behind them so that the links stay connected when the RTFs are moved.

You could also create the overlay using our WPF diagram control, but it will have to be opened as an external WPF process from your main WinForms process.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint