这个涵数应该不是API吧?
是你自己或是别人写的涵数吗??

解决方案 »

  1.   

    是Win98新增API看看这个例子吧:
    http://www.dapha.net/vb/list.asp?id=260
      

  2.   

    BOOL GradientFill(
      HDC hdc,
      CONST PTRIVERTEX pVertex,
      DWORD dwNumVertex,
      CONST PVOID pMesh,
      DWORD dwNumMesh,
      DWORD dwMode
    ); 
     
    Parameters
    hdc 
    Handle to the destination device context. 
    pVertex 
    Pointer to an array of TRIVERTEX structures that each define a triangle vertex. 
    dwNumVertex 
    Number of vertices. 
    pMesh 
    Array of GRADIENT_TRIANGLE structures in triangle mode, or an array of GRADIENT_RECT structures in rectangle mode. 
    dwNumMesh 
    The number of elements (triangles or rectangles) in pMesh. 
    dwMode 
    Specifies gradient fill mode. This parameter can contain one of the following values. Value Meaning 
    GRADIENT_FILL_RECT_H In this mode, two endpoints describe a rectangle. The rectangle is defined to have a constant color (specified by the TRIVERTEX structure) for the left and right edges. GDI interpolates the color from the top to bottom edge and fills the interior.  
    GRADIENT_FILL_RECT_V In this mode, two endpoints describe a rectangle. The rectangle is defined to have a constant color (specified by the TRIVERTEX structure) for the top and bottom edges. GDI interpolates the color from the top to bottom edge and fills the interior.  
    GRADIENT_FILL_TRIANGLE In this mode, an array of TRIVERTEX structures is passed to GDI along with a list of array indexes that describe separate triangles. GDI performs linear interpolation between triangle vertices and fills the interior. Drawing is done directly in 24- and 32-bit-per-pixel modes. Dithering is performed in 16-, 8.4-, and 1-bit-per-pixel mode.  
    Return Values
    If the function succeeds, the return value is TRUE.If the function fails, the return value is FALSE.Windows NT: To get extended error information, callGetLastError.Res
    To add smooth shading to a triangle, call the GradientFill function with the three triangle endpoints. GDI will linearly interpolate and fill the triangle. To add smooth shading to a rectangle, call GradientFill with the upper-left and lower-right coordinates of the rectangle. There are two shading modes used when drawing a rectangle. In horizontal mode, the rectangle is shaded from left to right. In vertical mode, the rectangle is shaded from top to bottom. The GradientFill function uses a mesh method to specify the endpoints of the object to draw. All vertices are passed to GradientFill in the pVertex array. The pMesh parameter specifies how these vertices are connected to form an object. When filling a rectangle, pMesh points to an array of GRADIENT_RECT structures. Each GRADIENT_RECT structure specifies the index of two vertices in the pVertex array. These two vertices form the upper-left and lower-right boundary of one rectangle. In the case of filling a triangle, pMesh points to an array of GRADIENT_TRIANGLE structures. Each GRADIENT_TRIANGLE structure specifies the index of three vertices in the pVertex array. These three vertices form one triangle. In order to simplify hardware acceleration, this routine is not required to be pixel-perfect in the triangle interior. For more information, see Smooth Shading, Drawing a Shaded Triangle, and Drawing a Shaded Rectangle. QuickInfo
      Windows NT: Requires version 5.0 or later.
      Windows: Requires Windows 98 or later.
      Windows CE: Unsupported.
      Header: Declared in wingdi.h.
      Import Library: Included as a resource in msimg32.dll.GRADIENT_RECT
    [This is preliminary documentation and subject to change.] The GRADIENT_RECT structure specifies the index of two vertices in the pVertex array. These two vertices form the upper-left and lower-right boundaries of a rectangle.typedef struct _GRADIENT_RECT
    {
        ULONG    UpperLeft;
        ULONG    LowerRight;
    }GRADIENT_RECT, *PGRADIENT_RECT,*LPGRADIENT_RECT;
     
    Members
    UpperLeft 
    Specifies the upper-left corner of a rectangle. 
    LowerRight 
    Specifies the lower-right corner of a rectangle. 
    Res
    The GRADIENT_RECT structure contains the values used in the dwMode parameter of the GradientFill function. For related GradientFill structures, see GRADIENT_TRIANGLE and TRIVERTEX.For an example of the use of this structure, see Drawing a Shaded Rectangle. QuickInfo
      Windows NT: Requires version 5.0 or later.
      Windows: Requires Windows 98 or later.
      Windows CE: Unsupported.
      Header: Declared in wingdi.h.
    GRADIENT_TRIANGLE
    [This is preliminary documentation and subject to change.] The GRADIENT_TRIANGLE structure specifies the index of three vertices in the pVertex array. These three vertices form one triangle. typedef struct _GRADIENT_TRIANGLE
    {
        ULONG    Vertex1;
        ULONG    Vertex2;
        ULONG    Vertex3;
    }GRADIENT_TRIANGLE,*PGRADIENT_TRIANGLE,*LPGRADIENT_TRIANGLE;
     
    Members
    Vertex1 
    First point of the triangle where sides intersect. 
    Vertex2 
    Second point of the triangle where sides intersect. 
    Vertex3 
    Third point of the triangle where sides intersect. 
    Res
    The GRADIENT_TRIANGLE structure contains the values used in the dwMode parameter of the GradientFill function. For related GradientFill structures, see GRADIENT_RECT and TRIVERTEX.For an example of this function, see Drawing a Shaded Triangle. QuickInfo
      Windows NT: Requires version 5.0 or later.
      Windows: Requires Windows 98 or later.
      Windows CE: Unsupported.
      Header: Declared in wingdi.h.
    TRIVERTEX
    [This is preliminary documentation and subject to change.] The TRIVERTEX structure contains color information and position information. typedef USHORT COLOR16;
    typedef struct _TRIVERTEX
    {
        LONG        x;
        Long        y;
        COLOR16     Red;
        COLOR16     Green;
        COLOR16     Blue;
        COLOR16     Alpha;
    }TRIVERTEX,*PTRIVERTEX,*LPTRIVERTEX;
     
    Members

    Specifies the x-coordinate, in logical units, of the upper-left corner of the rectangle. 

    Specifies the y-coordinate, in logical units, of the upper-left corner of the rectangle. 
    Red 
    Indicates color information at the point of x, y. 
    Green 
    Indicates color information at the point of x, y. 
    Blue 
    Indicates color information at the point of x, y. 
    Alpha 
    Indicates color information at the point of x, y. 
    Res
    In the TRIVERTEX structure, x and y indicate position in the same manner as in the POINTL structure contained in the wtypes.h header file. Red, Green, Blue, and Alpha members indicate color information at the point x, y. The color information of each channel is specified as a value from 0x0000 to 0xff00. This allows higher color resolution for an object that has been split into small triangles for display. The TRIVERTEX structure contains information needed by the pVertex parameter of GradientFill. For an example of the use of this structure, see Drawing a Shaded Triangle and Drawing a Shaded Rectangle. QuickInfo
      Windows NT: Requires version 5.0 or later.
      Windows: Requires Windows 98 or later.
      Windows CE: Unsupported.
      Header: Declared in wingdi.h.
      

  3.   

    那个例子里面没有用到这个函数,所以没有什么帮助。
    这个函数我用BCB试过的,效果很好,但不会用VB调用。
      

  4.   

    就在Form1中!
    仔细看:Private Declare Function GradientFillRect Lib "msimg32" Alias "GradientFill" (ByVal hdc As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As GRADIENT_RECT, ByVal dwNumMesh As Long, ByVal dwMode As Long) As Long
    Private Declare Function GradientFillTri Lib "msimg32" Alias "GradientFill" (ByVal hdc As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As GRADIENT_TRIANGLE, ByVal dwNumMesh As Long, ByVal dwMode As Long) As Long