Пример #1
0
 private void paintShot(QPainter painter)
 {
     painter.Begin(this);         // should not be necessary
     painter.SetPen(Qt.PenStyle.NoPen);
     painter.SetBrush(new QBrush(Qt.GlobalColor.black));
     painter.DrawRect(shotRect());
     painter.End();         // should not be necessary
 }
Пример #2
0
    private void paintCannon(QPainter painter)
    {
        painter.Begin(this);         // should not be necessary
        painter.SetPen(Qt.PenStyle.NoPen);
        painter.SetBrush(new QBrush(Qt.GlobalColor.blue));

        painter.Save();
        painter.Translate(0, Height());
        painter.DrawPie(new QRect(-35, -35, 70, 70), 0, 90 * 16);
        painter.Rotate(-currentAngle);
        painter.DrawRect(barrelRect);
        painter.Restore();
        painter.End();         // should not be necessary
    }