Different patterns of irregular form of: Li Xiaofei
Download this article Example Project Startsing that the unlimited form may feel fresh, this is because we use most of the forms of forms with a regular mass rectangular form, Word, a famous software, you have to use it. After, then press the F1 key in your hand in Word, how is the form of the pop-up form, it's very dazzling! (As shown below). So do you have such a form? simple! A few words can be easily set. But before revealing the answer, we will first become familiar with the realization of the unlimited form in Windows. 1. Several major functions for creating an irregular form: <1> createRectrGn: Create a rectangular form outline. <2> CREATEROUNDRECTRGN: Create a rounded rectangular form profile. <3> CREATEELLIPTICRGN: Create a circular or elliptical form profile. <4> CreatePolygonRGN: Create a polygon window profile.
The above function can be used directly when creating an irregular form outline, and there is no need to specify the contour path. If you want the form more complicated, you can use CombinerGN to mix multiple contour paths to achieve. The above functions can also be implemented with BeginPath, EndPath, and Pathtoregion. In fact, these three functions provide users with maximum creation and play space, allowing user to customize the form outline path, so users can pick up PEN To draw all what you want, what rectangle / ellipse / polygon / arc shape ... can be easily set, even the font can be used as the shape of the form. Second, change the shape of the form: We create your own form shape, so how to inform Windows to change the shape of the form? The secret is only one sentence: setwindowrgn.
Note: The examples comes with the example of BeginPath, EndPath and Pathtoregion explains how to achieve irregular forms. Third, the specific implementation steps: Said so many functions, then let us take a look at how to use BeginPath, Endpath and Pathtoregion. The following will look at the use steps of the three in a font form. Suppose the following code is placed in the Click event of a button: