2

long time lurker and self taught OOP and c# thanks in good majority to the great people here. 99% of my problems I seem to find out by searching all over the net but I'm stuck with this one.

My problem is that I have a custom GUI where I'm stacking elementhost control elements that host WPF user controls. I have successfully made these graphics appear and perform their behavior but they are not transparent with respect to each other. I have stacked icons that overlap each other with a semi transparent edges where they should blend together. The icons were made in paint.net and indeed have correct graphics for transparency. Using host.BackColorTransparency = true, I was able to make these element hosts transparent to background of my winforms GUI, but they are still not transparent with respect to each other.

I'm trying to be as descriptive as I can here. And since this is a work project I cannot display any proprietary information. Please let me know if anyone needs any more information. Thank you for any help.

bassplayer142
  • 380
  • 2
  • 3
  • 15
  • So I have added this code into the constructor. – bassplayer142 Jan 15 '13 at 16:06
  • host1 = new ElementHost(); host1.Location = new Point(389, 255); bigScroll1 = new BigScroll(); host1.Child = bigScroll1; host2 = new ElementHost();//element host host2.Location = new Point(220, 280); medScroll1 = new MedScroll(); //wpf user control with image host2.Child = medScroll1; host1.Controls.Add(host2); host2.Location = new Point(0, 0); host2.BackColor = Color.Transparent; Neither of them are visible now on the form. Not sure what to do from here. There is no onpaint event either. – bassplayer142 Jan 15 '13 at 16:13

1 Answers1

1

This MSDN article mentions a trick called 'bitmap copying'.

Actually this means the ElementHost paints the background of the owner control to its own drawing surface. This is a simple 1:1 relation. It does not take the overlapping controls into account.

Myrtle
  • 5,761
  • 33
  • 47