Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than gdi32, prefix the name with the module name and a period.
GradientFill (gdi32)
.
C# Signature:
[DllImport("gdi32.dll", EntryPoint="GdiGradientFill", ExactSpelling = true)]
public static extern bool GradientFill(
IntPtr hdc, // handle to DC
TRIVERTEX[] pVertex, // array of vertices
uint dwNumVertex, // number of vertices
GRADIENT_RECT[] pMesh, // array of gradients
uint dwNumMesh, // size of gradient array
uint dwMode // gradient fill mode);
[DllImport("gdi32.dll", EntryPoint="GdiGradientFill", ExactSpelling = true)]
public static extern bool GradientFill(
IntPtr hdc, // handle to DC
TRIVERTEX[] pVertex, // array of vertices
uint dwNumVertex, // number of vertices
GRADIENT_TRIANGE[] pMesh, // array of gradients
uint dwNumMesh, // size of gradient array
uint dwMode // gradient fill mode);
// This one draws either rectangles or triangles
[DllImport("gdi32.dll", EntryPoint = "GdiGradientFill", ExactSpelling = true)]
public static extern bool GradientFill(
IntPtr hdc, // handle to DC
TRIVERTEX[] pVertex, // array of vertices
uint dwNumVertex, // number of vertices
uint[] pMesh, // array of gradients
uint dwNumMesh, // size of gradient array
uint dwMode // gradient fill mode);
VB Signature:
Declare Function GradientFill Lib "gdi32.dll" (TODO) As TODO
The dwMode is one of the constants from GRADIENT_.
Alternative Managed API:
Do you know one? Please contribute it!
Notes:
The GDI32.dll does not contain a GradientFill() function. The actual entry point is GdiGradientFill(). That's why the 'EntryPoint' attribute is present.
This method creates one entry each for rectangles and triangles. It's just a matter of convenience and error checking by the compiler.
Tips & Tricks:
Please add some!
Sample Code:
public class Gradient
{
public const uint
GRADIENT_FILL_RECT_H = 0x00000000,
GRADIENT_FILL_RECT_V = 0x00000001,
GRADIENT_FILL_TRIANGLE = 0x00000002,
GRADIENT_FILL_OP_FLAG = 0x000000ff;
[DllImport("gdi32.dll", EntryPoint="GdiGradientFill", ExactSpelling = true)]
public static extern bool GradientFill(
IntPtr hdc, // handle to DC
TRIVERTEX[] pVertex, // array of vertices
uint dwNumVertex, // number of vertices
GRADIENT_RECT[] pMesh, // array of gradients
uint dwNumMesh, // size of gradient array
uint dwMode // gradient fill mode
);
public static void DrawNiceRectangle(hDC graphPort, Rectangle Frame)
{
// Draw from whitish blue at the top, to a light blue at the bottom
TRIVERTEX[] vert = new TRIVERTEX[]{
new TRIVERTEX(Frame.Left,Frame.Top,0xff00,0xff00,0xffff,0x0),
new TRIVERTEX(Frame.Right,Frame.Bottom,0x0000,0x0000,0xff00,0x0)};
GRADIENT_RECT[] gRect = new GRADIENT_RECT[]{
new GRADIENT_RECT(0,1)};
3/16/2007 7:31:57 AM - anfortas.geo@yahoo.com-216.204.61.86
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).