SupportsTransparentBackColor

I’m setting
SupportsTransparentBackColor for GoView to TRUE. But when I put GoObject on GoView and begin drag this item transparency disappered.
I have a form. There is the GoView Control on it. I need to make the control semi-transparent while the form becomes transparent, so that I can see what goes on under the form.
What can I do?

I don’t believe that such behavior is supported, but you could try overriding GoView.PaintPaperColor. I haven’t tried this, and I don’t think anyone else at Northwoods has done so either.
Has anyone else tried this?

I can send you sample project. Control with Alpha using backcolor stop redraw.
It’s issue of the day for me.

How can I do this?
Thank you

I am trying to use transparent background color for my goview which throwing an error stating “transparent color is not supported”. Is there anyway to use transparent color for my view… Advance thanks for ur help…

The suggestion to override GoView.PaintPaperColor appears to still be the best advice.

I believe that won’t work – the GoView control was designed to be opaque.

what you get is a hole in your app where the GoView is, and whatever is behind it is snapshoted when the Paint happens and static after that.

Hard to see how that would be useful.

I’d like to draw a data grid behind a GoView and make the GoView background transparent so the grid lines are visible through the GoView. Any suggestions? BTW - I don’t even see GoView.PaintPaperColor. (currently evaluating version 4.1 for win forms .net)

Are you trying to use the datagrid to show data, or just as a way to get grid lines? GoView supports drawing gridlines already…

GoView.PaintPaperColor is “protected virtual”, you have to override it.

Left side of the grid contains tabular data. Right side contains a related diagram related to the data on the left side. I’d like to draw the diagram with GoDiagrams. The nodes in the diagram need to align with both rows and columns on the grid. I’d like the grid lines to be visible through the GoDiagram - otherwise, it isn’t going to look quite right and I’m going to have to do a lot more coding - in which case, maybe I should just write the code to draw the diagram myself - but I’m hoping Go can save me a lot of trouble and help build a more robust solution.

Depending on how much actual datagrid function you are using, it may just be simpler to build the “grid” using a GoMultiTextNode (see some samples in NodeLinkDemo).



I do have a sample of a simple Gantt chart that uses a TreeView side by side with a GoView. I’ll email you that.

Got your email - thanks. I AM using a lot of the grid functionality - it is critically important - I’d say it is more important than the diagram.



What I’m trying now:

* hide the GoView in the GoView.Parent’s Invalidated event

* capture whatever is underneath the GoView in a bitmap in the Parent.Validated event

* set the GoView.BackgroundImage to that Bitmap

and show the GoView



(of course avoid an infinite loop along the way)



It ALMOST works.

All you have to do is derive from GoView. Handle the parent control’s paint event. In the handler: Hide the diagram. Take a screenshot of the area under the diagram. Set that as the background of the diagram and then show the diagram.



Ugly…but it works for me:



void Parent_Paint(object sender, PaintEventArgs e)

{

// member variable

if (_updatingBackground)

return;



try

{

_updatingBackground = true;



int w = (int)this.Size.Width;

int h = (int)this.Size.Height;

if (w == 0 || h == 0)

return;



this.Hide();

this.Parent.Refresh();



this.BorderStyle = BorderStyle.None;

Rectangle rect = new Rectangle(0, 0, w, h);

rect = this.RectangleToScreen(rect);



Bitmap bmp = new Bitmap(w, h);

Graphics g = Graphics.FromImage(bmp);

int x = (int)rect.X;

int y = (int)rect.Y;

g.CopyFromScreen(x, y, 0, 0, rect.Size, CopyPixelOperation.SourceCopy);



this.BackgroundImage = bmp;

this.Show();

}

finally

{

_updatingBackground = false;

}

}

clever. thanks.

Something I should point out, Walter says this would be trivial with GoXam (under Silverlight or WPF):



“You could put the control behind the Diagram, since the Diagram can have a transparent background.



Or you could put it in the background layer of the Diagram (so that it would be scrolled and scaled along with the diagram).”