How can I add a shadow around a form with no border?

前端 未结 1 430
说谎
说谎 2021-01-21 07:12

I am trying to figure out how to add a full shadow around a borderless form, using WinForms. I am looking at adding a shadow around all four sides of the form.

I have t

相关标签:
1条回答
  • 2021-01-21 07:54

    You are going to have to manually draw this. I have done something similar before with a splash screen, I think. You need to decide the offset of the shadow from the client area of the form and either create a container (easier layout wise) to host its constituent controls or redefine its client rectangle programmatically if you need dynamic shadow size, and then draw your border. If memory serves, you will get the best results using alpha blending + lineargradientbrush to fade the shadow transparency out to the edges.

    0 讨论(0)
提交回复
热议问题