views:

555

answers:

2

Hi,

is it possible to overlay a control (lets say a rich text box or a link label) over onother control at a specific position on a Winform?

I have did some test with GDI+ but without luck...

+2  A: 

You can place one control on top of the other, but it will obscure the one under it. Some controls (like Label) support transparent background, in which case it won't obscure the control under it.

Judah Himango
A: 

Do you want both to be visible at the same time? If so, check out [http://msdn.microsoft.com/en-us/library/wk5b13s4(VS.71).aspx].

If it's simply a matter of putting two controls in the same place and showing one or the other, you can use Control.BringToFront() and .SendToBack(), as well as individually controlling their visibilities.

Finally, if it's text you want to draw on top of another control, you might want to look into drawing that text yourself from that other control - the TextRenderer ([http://msdn.microsoft.com/en-us/library/system.windows.forms.textrenderer.aspx]) class makes it very easy to do so.

jean