本文整理汇总了C++中gdiplus::GraphicsPath::AddRectangle方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsPath::AddRectangle方法的具体用法?C++ GraphicsPath::AddRectangle怎么用?C++ GraphicsPath::AddRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gdiplus::GraphicsPath
的用法示例。
在下文中一共展示了GraphicsPath::AddRectangle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawGradientFill
void CDisplayWindow::DrawGradientFill(HDC hdc,RECT *rc)
{
if(m_hBitmapBackground)
{
DeleteObject(m_hBitmapBackground);
}
/* Create the (temporary) off-screen buffer used for drawing. */
m_hBitmapBackground = CreateCompatibleBitmap(hdc,rc->right - rc->left,rc->bottom - rc->top);
SelectObject(m_hdcBackground,m_hBitmapBackground);
Gdiplus::Graphics graphics(m_hdcBackground);
Gdiplus::Rect DisplayRect(0,0,rc->right - rc->left,rc->bottom - rc->top);
Gdiplus::GraphicsPath Path;
Path.AddRectangle(DisplayRect);
Gdiplus::PathGradientBrush pgb(&Path);
pgb.SetCenterPoint(Gdiplus::Point(0,0));
pgb.SetCenterColor(m_CentreColor);
INT count = 1;
pgb.SetSurroundColors(&m_SurroundColor,&count);
graphics.FillRectangle(&pgb,DisplayRect);
/* This draws a separator line across the top edge of the window,
so that it is visually separated from other windows. */
Gdiplus::Pen NewPen(BORDER_COLOUR,1);
graphics.DrawLine(&NewPen,0,0,rc->right,0);
}
示例2: DrawImage
void CSkinUnitODL::DrawImage(Gdiplus::Graphics& gcDrawer, Gdiplus::RectF rtDrawArea, Gdiplus::REAL fScale)
{
if (m_imgSkin)
{
Gdiplus::GraphicsPath gcPath;
gcPath.AddRectangle(rtDrawArea);
DrawImage(gcDrawer, gcPath, Gdiplus::PointF(rtDrawArea.X,rtDrawArea.Y), fScale);
}
}
示例3: Draw
void SelectionHandler::Draw(CDC& offscreenDC)
{
if (m_selectionState == selstateNoSelection) return;
COORD coordStart;
COORD coordEnd;
SHORT maxX = (m_consoleParams->dwBufferColumns > 0) ?
static_cast<SHORT>(m_consoleParams->dwBufferColumns - 1) :
static_cast<SHORT>(m_consoleParams->dwColumns - 1);
GetSelectionCoordinates(coordStart, coordEnd);
SMALL_RECT& srWindow = m_consoleInfo->csbi.srWindow;
if( coordEnd.Y < srWindow.Top ||
coordStart.Y > srWindow.Bottom ) return;
INT nXStart = (static_cast<INT>(coordStart.X) - static_cast<INT>(srWindow.Left)) * m_nCharWidth + m_nVInsideBorder;
INT nYStart = (static_cast<INT>(coordStart.Y) - static_cast<INT>(srWindow.Top) ) * m_nCharHeight + m_nHInsideBorder;
INT nXEnd = (static_cast<INT>( coordEnd.X) - static_cast<INT>(srWindow.Left)) * m_nCharWidth + m_nVInsideBorder;
INT nYEnd = (static_cast<INT>( coordEnd.Y) - static_cast<INT>(srWindow.Top) ) * m_nCharHeight + m_nHInsideBorder;
INT nXmin = (static_cast<INT>(0) - static_cast<INT>(srWindow.Left)) * m_nCharWidth + m_nVInsideBorder;
INT nXmax = (static_cast<INT>(maxX) - static_cast<INT>(srWindow.Left)) * m_nCharWidth + m_nVInsideBorder;
Gdiplus::Graphics gr(offscreenDC);
Gdiplus::Color selectionColor;
selectionColor.SetFromCOLORREF(g_settingsHandler->GetAppearanceSettings().stylesSettings.crSelectionColor);
Gdiplus::Pen pen (selectionColor);
Gdiplus::SolidBrush brush(Gdiplus::Color(64, selectionColor.GetR(), selectionColor.GetG(), selectionColor.GetB()));
Gdiplus::GraphicsPath gp;
if( nYStart == nYEnd )
{
Gdiplus::Rect rect(
nXStart,
nYStart,
(nXEnd - nXStart) + m_nCharWidth,
m_nCharHeight);
gp.AddRectangle(rect);
}
else
{
/*
2_________3
0______| |
| 1 5___|
|____________| 4
7 6
*/
Gdiplus::Point points[8];
points[0].X = nXmin;
points[0].Y = nYStart + m_nCharHeight;
points[1].X = nXStart;
points[1].Y = points[0].Y;
points[2].X = points[1].X;
points[2].Y = nYStart;
points[3].X = nXmax + m_nCharWidth;
points[3].Y = points[2].Y;
points[4].X = points[3].X;
points[4].Y = nYEnd;
points[5].X = nXEnd + m_nCharWidth;
points[5].Y = points[4].Y;
points[6].X = points[5].X;
points[6].Y = nYEnd + m_nCharHeight;
points[7].X = points[0].X;
points[7].Y = points[6].Y;
gp.AddPolygon(points, 8);
}
gr.FillPath(&brush, &gp);
gr.DrawPath(&pen, &gp);
}
示例4: AddRectangle
void GraphicsPath::AddRectangle(const RectF& rc) {
Gdiplus::GraphicsPath* gp = reinterpret_cast<Gdiplus::GraphicsPath*>(_private);
gp->AddRectangle(ToGDIRect<RectF, Gdiplus::RectF>(rc));
}