Home > Software engineering >  How to tilt the rectangle fill color in MFC
How to tilt the rectangle fill color in MFC

Time:10-15

I drew a tilted rectangle in the MFC, known rectangular four points, how to rectangular fill color! Code, thank you

CodePudding user response:

D2D words with a rotation matrix line , GDI estimates only himself

CodePudding user response:

Rectangular area are defined with the start-point RGN and fill color,

CodePudding user response:

"PLGBLT.zip
"http://download.csdn.net/detail/schlafenhamster/3343102
"Microsoft's example, compiled using vc60, explain PLGBLT usage"

CodePudding user response:

Can be used in the MFC and gdi and gdi + drawpath
Idea is put after you spin the rectangle out into a path and then draw four points,

This method can draw any irregular shape

CodePudding user response:

FloodFill
The FloodFill function fills The an area of The display surface with The current brush. The area is assumed to be bounded as specified by The crFill parameter.

Note The FloodFill function is included only for compatibility with 16 - bit versions of Windows. For Win32 - -based applications, use The ExtFloodFill function with FLOODFILLBORDER specified.

BOOL FloodFill (
HDC HDC,//handle to the device context
Int nXStart,//x - coordinate, where the fill begins
Int nYStart,//y - coordinate, where the fill begins
COLORREF crFill//fill color
);

The Parameters
HDC
Handle to a device context.
NXStart
Specifies the logical x coordinate of the point where filling is to begin.
NYStart
Specifies the logical y - coordinate of the point where filling is to begin.
CrFill
Specifies the color of the boundary or of the area to be filled.
The Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Windows NT: the To get extended error information, callGetLastError.

Few
Following are having this function took fail:

The fill could not be completed.
The given point from The boundary color specified by The crFill parameter.
The given point lies outside The current clipping region - that is, it is not visible on The device.
See Also
Bitmaps the Overview, Bitmap Functions provides, ExtFloodFill


CodePudding user response:

The CDC: : FloodFill
BOOL FloodFill (int x, int y, a COLORREF crColor);

The Return Value

Nonzero if the function is successful; Otherwise zero is returned if the filling could not be completed, the given point from the boundary color specified by crColor, or the point is outside the clipping region.

The Parameters

X

Specifies the logical x coordinate of the point where filling begins.

Y

Specifies the logical y - coordinate of the point where filling begins.

CrColor

Specifies the color of the boundary.

Few

Fills the an area of the display surface with the current brush. The area is assumed to be bounded as specified by crColor. The FloodFill function begins at the point specified by x and y and continues in all directions to the color boundary.

Only the memory - device contexts and devices that support raster - display technology support the FloodFill member function. For information about RC_BITBLT capability, see the GetDeviceCaps member function.

The ExtFloodFill function provides similar capability but greater flexibility.

The CDC Overview | Class Members | Hierarchy Chart

See Also the CDC: : ExtFloodFill, CDC: : GetDeviceCaps, : : FloodFill

CodePudding user response:

Look at this article will be helpful to you
http://tiannanyi.blog.163.com/blog/static/187359344201348944724/

CodePudding user response:

Store four vertices into an array, such as m_Vertex [4], then use dc. The Polygon (m_Vertex, 5), reoccupy CBrush filling,
CBrush brush (RGB (0255, 0)), * pOldBrush;//(linear, line, line color)
CClientDC dc (this);//create a DC
POldBrush=dc. SelectObject (& amp; Brush);
Dc. Polygon (m_Vertex, 5);//is a total index + 1 point
  • Related