简体   繁体   中英

Overlay Control over Winform

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...

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.

Do you want both to be visible at the same time? If so, check out Giving Your Control a Transparent Background .

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 class makes it very easy to do so.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM