本文整理汇总了C++中GraphicsPath::GetPathData方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsPath::GetPathData方法的具体用法?C++ GraphicsPath::GetPathData怎么用?C++ GraphicsPath::GetPathData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsPath
的用法示例。
在下文中一共展示了GraphicsPath::GetPathData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reshape
// Calculates tab's elements, based on its width and height.
// Generates a GraphicsPath, which is used for painting the tab, etc.
bool Reshape(int dx, int dy) {
dx--;
if (width == dx && height == dy)
return false;
width = dx;
height = dy;
GraphicsPath shape;
// define tab's body
shape.AddRectangle(Rect(0, 0, width, height));
shape.SetMarker();
// define "x"'s circle
int c = int((float)height * 0.78f + 0.5f); // size of bounding square for the circle
int maxC = DpiScaleX(hwnd, 17);
if (height > maxC) {
c = DpiScaleX(hwnd, 17);
}
Point p(width - c - DpiScaleX(hwnd, 3), (height - c) / 2); // circle's position
shape.AddEllipse(p.X, p.Y, c, c);
shape.SetMarker();
// define "x"
int o = int((float)c * 0.286f + 0.5f); // "x"'s offset
shape.AddLine(p.X + o, p.Y + o, p.X + c - o, p.Y + c - o);
shape.StartFigure();
shape.AddLine(p.X + c - o, p.Y + o, p.X + o, p.Y + c - o);
shape.SetMarker();
delete data;
data = new PathData();
shape.GetPathData(data);
return true;
}
示例2: Reshape
// Calculates tab's elements, based on its width and height.
// Generates a GraphicsPath, which is used for painting the tab, etc.
bool Reshape(int dx, int dy) {
dx--;
if (width == dx && height == dy)
return false;
width = dx; height = dy;
GraphicsPath shape;
// define tab's body
int c = int((float)height * 0.6f + 0.5f); // size of bounding square for the arc
shape.AddArc(0, 0, c, c, 180.0f, 90.0f);
shape.AddArc(width - c, 0, c, c, 270.0f, 90.0f);
shape.AddLine(width, height, 0, height);
shape.CloseFigure();
shape.SetMarker();
// define "x"'s circle
c = height > 17 ? 14 : int((float)height * 0.78f + 0.5f); // size of bounding square for the circle
Point p(width - c - 3, (height - c) / 2); // circle's position
shape.AddEllipse(p.X, p.Y, c, c);
shape.SetMarker();
// define "x"
int o = int((float)c * 0.286f + 0.5f); // "x"'s offset
shape.AddLine(p.X+o, p.Y+o, p.X+c-o, p.Y+c-o);
shape.StartFigure();
shape.AddLine(p.X+c-o, p.Y+o, p.X+o, p.Y+c-o);
shape.SetMarker();
delete data;
data = new PathData();
shape.GetPathData(data);
return true;
}