C#-Based Window Shadow Effect Scheme - Open Source Research Series Articles

         Recently, I was studying the effect of C#'s Winform form. Last time I introduced the blog post of the form animation effect (the perfect solution based on C#'s borderless form animation effect - open source research series articles ), this time the form shadow effect An introduction to the program.

         After looking for Du Niang, there are two methods for the specific window shadow effect: direct drawing and using double windows. What is presented here is the two-window approach.

  1. Project directory;

  The author has made the code of the shadow effect of the form into a form inheritance method, just inherit the form class directly.

        

  2. Function introduction;

  There are some comments in the class. Readers can combine them to understand, mainly because they know how to use them. If they need to be combined with other classes, they can read the source code carefully.

  Here is some code for the drawing layer:

   

         Control layer code:

        

  3. Operation effect;

  The following is an effect of the form running:

        

  4. Source code download;

  The source code download of the program is provided here, readers who need it can download and use it by themselves:

  https://download.csdn.net/download/lzhdim/88142860

  The author once put this window shadow effect scheme together with the last animation effect, but it didn't work, because the window shadow effect uses double windows, and the window animation works on the control layer. If the double windows The body uses window animation, so there is still a window animation delay when minimizing and maximizing, which is very obvious, so the window animation cannot be applied here, and interested readers please provide solutions .

Note: It is recommended that the effect of the form is better to use the control method. Later, the author will introduce the effect of the use of related open source controls.

Guess you like

Origin blog.csdn.net/lzhdim/article/details/132074895