Example #1
0
        public GradientRect(int left, int top, int width, int height, Colorref startColor, Colorref endColor, GradientRectDirection style)
        {
            fRect = new RECT(left, top, width, height);

            fVertices = new TRIVERTEX[2];
            fGradientRect = new GRADIENT_RECT[1];

            fGradientRect[0] = new GRADIENT_RECT();

            SetVertices(left, top, width, height);

            // Set Colors for left/top
            fVertices[0].Red = startColor.Red16;
            fVertices[0].Green = startColor.Green16;
            fVertices[0].Blue = startColor.Blue16;
            fVertices[0].Alpha = 0x0000;

            // Set Colors for right/bottom
            fVertices[1].Red = endColor.Red16;
            fVertices[1].Green = endColor.Green16;
            fVertices[1].Blue = endColor.Blue16;
            fVertices[1].Alpha = 0x0000;

            fGradientRect[0].UpperLeft = 0;
            fGradientRect[0].LowerRight = 1;

            fGradientDirection = style;
        }
Example #2
0
        public GradientRect(int left, int top, int width, int height, uint startColor, uint endColor, GradientRectDirection style)
        {
            fRect = new RECT(left, top, width, height);

            fVertices = new TRIVERTEX[2];
            fGradientRect = new GRADIENT_RECT[1];

            fGradientRect[0] = new GRADIENT_RECT();

            SetVertices(left, top, width, height);

            // Set Colors for left/top
            fVertices[0].Red = (ushort)(RGBColor.R(startColor) << 8);
            fVertices[0].Green = (ushort)(RGBColor.G(startColor) << 8);
            fVertices[0].Blue = (ushort)(RGBColor.B(startColor) << 8);
            fVertices[0].Alpha = 0x0000;

            // Set Colors for right/bottom
            fVertices[1].Red = (ushort)(RGBColor.R(endColor) << 8);
            fVertices[1].Green = (ushort)(RGBColor.G(endColor) << 8);
            fVertices[1].Blue = (ushort)(RGBColor.B(endColor) << 8);
            fVertices[1].Alpha = 0x0000;

            fGradientRect[0].UpperLeft = 0;
            fGradientRect[0].LowerRight = 1;

            fGradientDirection = style;
        }
Example #3
0
        public static void Pack(BufferChunk chunk, GRADIENT_RECT[] gRect)
        {
            int nRects = gRect.Length;

            chunk += nRects;
            for (int i = 0; i < nRects; i++)
            {
                chunk += gRect[i].UpperLeft;
                chunk += gRect[i].LowerRight;
            }
        }
    GRADIENT_RECT[] UnpackGRADIENT_RECT(BufferChunk chunk)
    {
        int nRects = chunk.NextInt32();

        GRADIENT_RECT[] pMesh = new GRADIENT_RECT[nRects];

        for (int i = 0; i < nRects; i++)
        {
            pMesh[i].UpperLeft = chunk.NextUInt32();
            pMesh[i].LowerRight = chunk.NextUInt32();
        }

        return pMesh;
    }
 public virtual void GradientFill(TRIVERTEX[] pVertex, GRADIENT_RECT[] pMesh, uint dwMode)
 {
     GDI32.GradientFill(HDC, pVertex, (uint)pVertex.Length, pMesh, (uint)pMesh.Length, dwMode);
 }
Example #6
0
 public static extern bool GradientRectangle(
   [In] SafeHandle hdc,                   // handle to DC
   TRIVERTEX[] pVertex,        // array of vertices
   int dwNumVertex,         // number of vertices
   GRADIENT_RECT[] pMesh,               // array of gradients
   int dwNumMesh,           // size of gradient array
   int dwMode               // gradient fill mode
 );
Example #7
0
 public GradientRect(TRIVERTEX[] vertices, GRADIENT_RECT[] mesh, GradientRectDirection style)
 {
     fVertices = vertices;
     fGradientRect = mesh;
     fGradientDirection = style;
 }
    // Gradient Fills
    public override void GradientRectangle(TRIVERTEX[] pVertex, GRADIENT_RECT[] pMesh, uint dwMode)
    {
        BufferChunk chunk = new BufferChunk(1024);
        chunk += GDI32.EMR_GRADIENTFILL;

        // Pack the vertices
        Pack(chunk, pVertex);

        // Pack the gradient mesh
        Pack(chunk, pMesh);

        // pack the mode
        chunk += dwMode;

        PackCommand(chunk);
    }