コード例 #1
0
        protected override void OnPaint(Alt.GUI.PaintEventArgs e)
        {
            base.OnPaint(e);


            Alt.Sketch.Graphics graphics = e.Graphics;


            Matrix matrix = graphics.Transform;

            {
                //  correct offset
                Alt.Sketch.Rect clientRectangle = ClientRectangle;
                Alt.Sketch.Rect rect            = clientRectangle;
                double          targetX         = (m_TargetX - (clientRectangle.Width / 2)) * clientRectangle.Width / rect.Width + clientRectangle.Width / 2;
                double          targetY         = (m_TargetY - (clientRectangle.Height / 2)) * clientRectangle.Height / rect.Height + clientRectangle.Height / 2;
                graphics.TranslateTransform(targetX, targetY);

                graphics.RotateTransform(angle);

                int radialStep = 30;
                int nSteps     = 5;
                int lineDXY    = radialStep * (nSteps + 1);

                graphics.FillCircle(m_TargetBrush, 0, 0, radialStep * nSteps);

                graphics.SmoothingMode = SmoothingMode.AntiAlias;

                graphics.DrawLine(m_TargetPen, 0, -lineDXY, 0, lineDXY);
                graphics.DrawLine(m_TargetPen, -lineDXY, 0, lineDXY, 0);

                for (int i = 1; i <= nSteps; i++)
                {
                    graphics.DrawCircle(m_TargetPen, 0, 0, radialStep * i);
                }
            }
            graphics.Transform = matrix;
        }
コード例 #2
0
    void PrintCommentWithLine(Alt.Sketch.Graphics graphics, QFont font, string comment, QFontAlignment alignment, double xOffset, ref double yOffset)
    {
        GraphicsState state = graphics.Save();

        yOffset += 20;
        graphics.TranslateTransform((int)xOffset, yOffset);

        font.Print(comment, alignment);

        Size bounds = font.Measure(comment, ClientWidth - 60, alignment);

        graphics.DrawLine(m_LinesPen, 0, 0, 0, bounds.Height + 20);

        yOffset += bounds.Height;

        graphics.Restore(state);
    }