我在MFC中畫了一個傾斜的矩形,已知矩形的四個點,如何給矩形填充顏色!求代碼,謝謝
uj5u.com熱心網友回復:
D2D的話用個旋轉矩陣就行了
,GDI的話估計只能自己算了
uj5u.com熱心網友回復:
用連通區域RGN定義矩形區域,然后填充顏色。uj5u.com熱心網友回復:
“plgblt.zip”http://download.csdn.net/detail/schlafenhamster/3343102
“微軟的例子,用vc60編譯,說明plgblt的使用方法”
uj5u.com熱心網友回復:
在mfc里邊可以用gdi 或者 gdi+的drawpath思路是把你旋轉以后的矩形4個點求出來轉成路徑然后畫。
這個方法可以來畫任意不規則形狀
uj5u.com熱心網友回復:
FloodFillThe FloodFill function fills 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 device context
int nXStart, // x-coordinate, where fill begins
int nYStart, // y-coordinate, where fill begins
COLORREF crFill // fill color
);
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.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Windows NT: To get extended error information, callGetLastError.
Remarks
Following are reasons this function might fail:
The fill could not be completed.
The given point has 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 Overview, Bitmap Functions, ExtFloodFill
uj5u.com熱心網友回復:
CDC::FloodFillBOOL FloodFill( int x, int y, COLORREF crColor );
Return Value
Nonzero if the function is successful; otherwise 0 is returned if the filling could not be completed, the given point has the boundary color specified by crColor, or the point is outside the clipping region.
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.
Remarks
Fills 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 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.
CDC Overview | Class Members | Hierarchy Chart
See Also CDC::ExtFloodFill, CDC::GetDeviceCaps,::FloodFill
uj5u.com熱心網友回復:
看看這篇文章會不會對你有幫助http://tiannanyi.blog.163.com/blog/static/187359344201348944724/
uj5u.com熱心網友回復:
把4個頂點儲存到一個陣列里,比如說是m_Vertex[4]里,然后用dc.Polygon(m_Vertex,5),再用CBrush填充就好了。CBrush brush(RGB(0,255,0)),*pOldBrush;//(線型,線粗,線色)
CClientDC dc(this); //創建一個DC
pOldBrush=dc.SelectObject(&brush);
dc.Polygon(m_Vertex,5);//總共是index+1個點
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/131319.html
標籤:界面
