Create an irregular window with VB

zhaozj2021-02-11  159

Create an irregular window with VB

http://www.tongyi.net Author: Xue Ning Source: China Computer Education Views: 324

So far, we have used VB-based program window to be standard quartet, which looks very good. If you want your programs to be different, you can use the following API functions to create an irregular window: CreateRectrgn (Byval X1 as long, byval x2 as long, byval y2 as ring) creates a The rectangular area, the four parameters represent the left, upper, right, downward coordinates; CreateellLipTicRGN (Byval X1 as long, byval Y1 as long, byval x2 as long, byval y2 as long) creates an elliptical area, the parameter is the same; CreatePolygonRgn (pPoint as POINTAPI, ByVal nCount as Long, ByVal nPolyFillMode as Long) 'Create a polygonal region, pPoint parameter is a POINTAPI array, nCount parameters Number of vertices, nPolyFillMode parameters fill mode; CombineRgn (ByVal hDestRgn as Long, ByVal HSRCRGN1 AS Long, Byval NCombineMode As Long, BYVAL NCOMBINEMODE AS Long, BYVAL NCOMBINEMODE AS Long 'combined two areas, HDESTRGN is the merged area, HSRCRGN1 and HSRCRGN2 are target areas to merge, NCOMBINEMODE is a merge method; setWindowRgn ((byval hwnd as long, BYVAL HRGN As long, BYVAL BREDRAW AS BOOLEAN '' Settings Forms for specified styles, HRGNs are created for the above functions, and BREDRAW decides whether to immediately redraw the form. With these "Shen Bingnee", we can do it with your heart Made a wide range of forms. The demonstration procedures are as follows: Private Declare Function CreatellipticRgn Lib "GDI32" (Byval X1 As Long, Byval Y1 As Long, Byval X2 As Long, Byval Y2 As long) As long private declare function setWindowRgn LIB "User32" (Byval HR) Gn as long, byval brew as boolean) AS Long Private Sun form_load () DIM X, Y As long x = createllipticRGN (0,0,100,200) y = setWindowRgn (me.hwnd, x, true) End Sub The above programs can create an ellipse Form, and debug in VB6.0, Win 98 environment. Interested friends can refer to the above API functions and the demonstration program to write other incomplete windows.

转载请注明原文地址:https://www.9cbs.com/read-5463.html

New Post(0)