mirror of
https://bitbucket.org/Ryfon/mux.git
synced 2026-01-05 19:30:39 -06:00
36 lines
893 B
C++
36 lines
893 B
C++
#include "StdAfx.h"
|
|
#include "GDIPlusHelper.h"
|
|
|
|
CGDIPlusHelper::CGDIPlusHelper(void)
|
|
{
|
|
}
|
|
|
|
CGDIPlusHelper::~CGDIPlusHelper(void)
|
|
{
|
|
}
|
|
|
|
GraphicsPath* CGDIPlusHelper::MakeRoundRect(Rect rect, INT percentageRounded)
|
|
{
|
|
ASSERT(percentageRounded >=1 && percentageRounded <= 100);
|
|
|
|
INT left = rect.X;
|
|
INT right = rect.X + rect.Width;
|
|
INT top = rect.Y;
|
|
INT bottom = rect.Y + rect.Height;
|
|
|
|
INT offsetX = (right - left) * percentageRounded / 100;
|
|
INT offsetY = (bottom - top) * percentageRounded / 100;
|
|
|
|
GraphicsPath pt;
|
|
GraphicsPath* path = pt.Clone();
|
|
|
|
path->AddArc(right - offsetX, top, offsetX, offsetY, 270, 90);
|
|
path->AddArc(right - offsetX, bottom - offsetY, offsetX, offsetY, 0, 90);
|
|
path->AddArc(left, bottom - offsetY, offsetX, offsetY, 90, 90);
|
|
path->AddArc(left, top, offsetX, offsetY, 180, 90);
|
|
path->AddLine(left + offsetX, top, right - offsetX / 2, top);
|
|
|
|
return path;
|
|
|
|
}
|