SetPen() 공개 메소드

public SetPen ( QColor color ) : void
color QColor
리턴 void
예제 #1
0
        protected override void PaintEvent(Qyoto.QPaintEvent arg1)
        {
            using (QPainter p = new QPainter(this)) {
                var rect = ContentsRect();
                //var fm = new QFontMetrics(Font);

                //if (fm.Width(Text) > rect.Width()) {
                    var gradient = new QLinearGradient(rect.TopLeft(), rect.TopRight());
                    gradient.SetColorAt(0.8, Palette.Color(QPalette.ColorRole.WindowText));
                    gradient.SetColorAt(1.0, new QColor(Qt.GlobalColor.transparent));
                    var pen = new QPen();
                    pen.SetBrush(new QBrush(gradient));
                    p.SetPen(pen);
                //}

                p.DrawText(rect, (int)Qt.TextFlag.TextSingleLine, Text);
            }
        }
예제 #2
0
            public override void Paint(Qyoto.QPainter painter, Qyoto.QStyleOptionGraphicsItem option, Qyoto.QWidget widget)
            {
                painter.SetRenderHint(QPainter.RenderHint.Antialiasing, true);
                int iconSize = m_Grid.IconSize;

                // Parent opacity overrides item opacity.
                var parentGroup = (RosterItemGroup)base.Group();

                if (parentGroup == null)                 // This happens while the item is being removed.
                {
                    return;
                }
                if (parentGroup.Opacity != 1)
                {
                    painter.SetOpacity(parentGroup.Opacity);
                }
                else
                {
                    painter.SetOpacity(m_Opacity);
                }

                QPixmap pixmap = (QPixmap)m_Grid.Model.GetImage(m_Item);

                Gui.DrawAvatar(painter, iconSize, iconSize, pixmap);

                if (IsHover)
                {
                    // FIXME: Do something?
                }

                if (m_Grid.ListMode)
                {
                    var rect = BoundingRect();
                    var pen  = new QPen();
                    pen.SetBrush(m_Grid.Palette.Text());
                    painter.SetPen(pen);

                    int x = iconSize + m_Grid.IconPadding;
                    painter.DrawText(x, 0, (int)rect.Width() - x, (int)rect.Height(), (int)Qt.TextFlag.TextSingleLine, m_Grid.Model.GetName(m_Item));
                }
            }
예제 #3
0
파일: cannonfield.cs 프로젝트: KDE/qyoto
 private void paintTarget(QPainter painter)
 {
     painter.SetPen(new QColor(Qt.GlobalColor.black));
     painter.SetBrush(new QBrush(Qt.GlobalColor.red));
     painter.DrawRect(targetRect());
 }
예제 #4
0
파일: cannonfield.cs 프로젝트: KDE/qyoto
 private void paintShot(QPainter painter)
 {
     painter.SetPen(Qt.PenStyle.NoPen);
     painter.SetBrush(new QBrush(Qt.GlobalColor.black));
     painter.DrawRect(shotRect());
 }
예제 #5
0
파일: cannonfield.cs 프로젝트: KDE/qyoto
    private void paintCannon(QPainter painter)
    {
        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();
    }
예제 #6
0
파일: t10.cs 프로젝트: KDE/qyoto
 protected override void PaintEvent(QPaintEvent ev)
 {
     using (QPainter painter = new QPainter(this)) {
         painter.SetPen(Qt.PenStyle.NoPen);
         painter.SetBrush(new QBrush(new QColor(0,0,255)));
         painter.Translate(0, Rect.Height());
         painter.DrawPie(new QRect(-35, -35, 70, 70), 0, 90 * 16);
         painter.Rotate(-currentAngle);
         painter.DrawRect(30, -5, 20, 10);
         painter.End(); // this should not be needed
     }
 }
            public override void Paint(Qyoto.QPainter painter, Qyoto.QStyleOptionGraphicsItem option, Qyoto.QWidget widget)
            {
                painter.SetOpacity(m_Opacity);

                var color = m_Grid.Palette.Color(QPalette.ColorRole.Text);

                // Group Name
                painter.SetFont(m_Font);
                painter.SetPen(new QPen(color));

                string text = null;

                if (m_Grid.ShowGroupCounts)
                {
                    text = String.Format("{0} ({1}/{2})",
                                         m_GroupName,
                                         m_Grid.Model.NumOnlineItemsInGroup(m_GroupName),
                                         m_Grid.Model.NumItemsInGroup(m_GroupName));
                }
                else
                {
                    text = m_GroupName;
                }

                painter.DrawText(BoundingRect(), text);

                int arrowX = m_Grid.IconPadding + m_Metrics.Width(text) + 4;
                int arrowY = 5;

                // Group expander arrow
                painter.Save();
                painter.Translate(arrowX, arrowY);
                QPainterPath path = new QPainterPath();

                if (IsExpanded)
                {
                    path.MoveTo(0, 0);
                    path.LineTo(4, 0);
                    path.LineTo(2, 2);
                    path.LineTo(0, 0);
                }
                else
                {
                    path.MoveTo(2, 0);
                    path.LineTo(2, 4);
                    path.LineTo(0, 2);
                    path.LineTo(2, 0);
                }
                painter.SetPen(new QPen(color));
                painter.SetBrush(new QBrush(color));
                painter.DrawPath(path);
                painter.Restore();

                m_ArrowRect = new QRectF(arrowX, 0, 4, m_Grid.HeaderHeight);

                if (ItemOver)
                {
                    painter.SetPen(new QPen(new QColor("red")));
                    painter.DrawRect(BoundingRect());
                }
            }
예제 #8
0
파일: analogclock.cs 프로젝트: KDE/qyoto
    protected override void PaintEvent(QPaintEvent e)
    {
        QColor hourColor = new QColor(127, 0, 127);
        QColor minuteColor = new QColor(0, 127, 127, 191);

        int side = QMin(Width(), Height());
        QTime time = QTime.CurrentTime();

        QPainter painter = new QPainter(this);
        painter.SetRenderHint(QPainter.RenderHint.Antialiasing);
        painter.Translate(Width() / 2, Height() / 2);
        painter.Scale(side / 200.0, side / 200.0);

        painter.SetPen(Qt.PenStyle.NoPen);
        painter.SetBrush(hourColor);

        painter.Save();
        painter.Rotate(30.0 * ((time.Hour() + time.Minute() / 60.0)));
        painter.DrawConvexPolygon(new QPolygon(hourHand));
        painter.Restore();

        painter.SetPen(hourColor);

        for (int i = 0; i < 12; ++i) {
            painter.DrawLine(88, 0, 96, 0);
            painter.Rotate(30.0);
        }

        painter.SetPen(Qt.PenStyle.NoPen);
        painter.SetBrush(minuteColor);

        painter.Save();
        painter.Rotate(6.0 * (time.Minute() + time.Second() / 60.0));
        painter.DrawConvexPolygon(new QPolygon(minuteHand));
        painter.Restore();

        painter.SetPen(minuteColor);

        for (int j = 0; j < 60; ++j) {
            if ((j % 5) != 0)
                painter.DrawLine(92, 0, 96, 0);
            painter.Rotate(6.0);
        }

        painter.End();
    }
예제 #9
0
파일: cannonfield.cs 프로젝트: KDE/qyoto
 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
 }
예제 #10
0
파일: cannonfield.cs 프로젝트: KDE/qyoto
 private void PaintTarget(QPainter painter)
 {
     painter.SetPen(Qt.GlobalColor.black);
     painter.SetBrush(Qt.GlobalColor.red);
     painter.DrawRect(TargetRect());
 }
예제 #11
0
파일: cannonfield.cs 프로젝트: KDE/qyoto
 private void PaintBarrier(QPainter painter)
 {
     painter.SetPen(Qt.GlobalColor.black);
     painter.SetBrush(Qt.GlobalColor.yellow);
     painter.DrawRect(BarrierRect());
 }
예제 #12
0
파일: cannonfield.cs 프로젝트: KDE/qyoto
    protected override void PaintEvent(QPaintEvent arg1)
    {
        QPainter painter = new QPainter(this);

        if (gameEnded) {
            painter.SetPen(Qt.GlobalColor.black);
            painter.SetFont(new QFont("Courier", 48, (int) QFont.Weight.Bold));
            painter.DrawText(Rect, (int) Qt.AlignmentFlag.AlignCenter, Tr("Game Over"));
        }

        PaintCannon(painter);
        PaintBarrier(painter);
        if (IsShooting)
            PaintShot(painter);
        if (!gameEnded)
            PaintTarget(painter);

        painter.End();
    }