本文整理匯總了C#中Qyoto.QPainter.FillPath方法的典型用法代碼示例。如果您正苦於以下問題:C# QPainter.FillPath方法的具體用法?C# QPainter.FillPath怎麽用?C# QPainter.FillPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Qyoto.QPainter
的用法示例。
在下文中一共展示了QPainter.FillPath方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DrawAvatar
public static void DrawAvatar(QPainter painter, int width, int height, QPixmap avatarPixmap)
{
QPainterPath path = new QPainterPath();
// Draw a rect without corners.
path.MoveTo(0, 1);
path.LineTo(1, 1);
path.LineTo(1, 0);
path.LineTo(width - 1, 0);
path.LineTo(width, 1);
path.LineTo(width, height - 1);
path.LineTo(width - 1, height - 1);
path.LineTo(width - 1, height);
path.LineTo(1, height);
path.LineTo(1, height - 1);
path.LineTo(0, height - 1);
path.LineTo(0, 1);
QLinearGradient g1 = new QLinearGradient(0, 0, 0, height);
g1.SetColorAt(0, new QColor("#888781"));
g1.SetColorAt(1, new QColor("#abaaa8"));
QBrush b1 = new QBrush(g1);
painter.FillPath(path, b1);
painter.FillRect(1, 1, width - 2, height - 2, new QBrush(Qt.GlobalColor.black));
// Darken the corners...
var b2 = new QBrush(new QColor(61, 61, 61, 102));
painter.FillRect(0, 0, 3, 3, b2);
painter.FillRect(width - 3, 0, 3, 3, b2);
painter.FillRect(0, width - 3, 3, 3, b2);
painter.FillRect(width - 3, width - 3, 3, 3, b2);
painter.DrawPixmap(2, 2, width - 4, height - 4, avatarPixmap);
}