コード例 #1
0
        private void Tools_Drawing(DrawingArgs arg)
        {
            RectangleF rect = tools.Bounds;

            if (arg.Transform != null)
            {
                var ltrb = new PointF[] { rect.Location, new PointF(rect.Right, rect.Bottom) };
                arg.Transform.TransformPoints(ltrb);
                rect = RectangleF.FromLTRB(ltrb[0].X, ltrb[0].Y, ltrb[1].X, ltrb[1].Y);
            }

            arg.Graphics.DrawString(Content, font, tools.DrawingBrush, rect, sf);
        }
コード例 #2
0
        //private void Tools_Preparing(PrepareArgs arg)
        //{
        //}

        private void Tools_Drawing(DrawingArgs arg)
        {
            //if (arg.RenderAll || arg.Graphics.Clip.IsVisible(tools.Bounds))
            //{
            if (arg.Transform != null)
            {
                var copy = new List <PointF>(__points).ToArray();
                arg.Transform.TransformPoints(copy);
                arg.Graphics.DrawLines(tools.DrawingPen, copy);
            }
            else
            {
                arg.Graphics.DrawLines(tools.DrawingPen, __points.ToArray());
            }
            //}
        }
コード例 #3
0
        //private void Tools_Preparing(PrepareArgs arg)
        //{

        //}


        private void Tools_Drawing(DrawingArgs arg)
        {
            //if (arg.RenderAll || arg.Graphics.Clip.IsVisible(tools.Bounds))
            //{
            PointF[] points = __points.ToArray();
            if (arg.Transform != null)
            {
                arg.Transform.TransformPoints(points);
            }

            if (tools.DrawingBrush != Brushes.Transparent)
            {
                arg.Graphics.FillPolygon(tools.DrawingBrush, points);
            }
            arg.Graphics.DrawPolygon(tools.DrawingPen, points);
            //}
        }
コード例 #4
0
ファイル: GDI_Rectangle.cs プロジェクト: RayMMond/Draw.NET
        //private void Tools_Preparing(PrepareArgs arg)
        //{

        //}

        private void Tools_Drawing(DrawingArgs arg)
        {
            RectangleF rectToDraw = rect;

            if (arg.Transform != null)
            {
                if (drawModel == DrawModel.Center)
                {
                    var center = new PointF[] { Center };
                    arg.Transform.TransformPoints(center);
                    rectToDraw = new RectangleF(center[0].X - rect.Width / 2, center[0].Y - rect.Height / 2, rect.Width, rect.Height);
                }
                else
                {
                    var ltrb = new PointF[] { rect.Location, new PointF(rect.Right, rect.Bottom) };
                    arg.Transform.TransformPoints(ltrb);
                    rectToDraw = RectangleF.FromLTRB(ltrb[0].X, ltrb[0].Y, ltrb[1].X, ltrb[1].Y);
                }
            }
            if (tools.DrawingBrush != Brushes.Transparent)
            {
                arg.Graphics.FillRectangle(tools.DrawingBrush, rectToDraw);
            }
            arg.Graphics.DrawRectangles(tools.DrawingPen, new RectangleF[] { rectToDraw });


            if (!string.IsNullOrWhiteSpace(Content) &&
                arg.Transform.Elements[0] >= 0.6)
            {
                if (LocationType == LocationType.Relative)
                {
                    text.StringSize = arg.Graphics.MeasureString(Content, text.Font);
                    int x = 0;
                    if (Alignment == StringAlignment.Far)
                    {
                        x = -(int)Math.Ceiling(text.StringSize.Width);
                    }
                    text.Location = new Point(x, (int)Math.Ceiling(-text.StringSize.Height));
                    text.Location = Point.Ceiling(rectToDraw.GetCornerPoint(CornerType.Top) + new SizeF(text.Location));
                }

                text.DrawText(new RectangleF(text.Location, text.StringSize), arg.Graphics);
            }
        }
コード例 #5
0
ファイル: GDI_Ellipse.cs プロジェクト: RayMMond/Draw.NET
        //private void Tools_Preparing(PrepareArgs arg)
        //{
        //}

        private void Tools_Drawing(DrawingArgs arg)
        {
            //if (arg.RenderAll || arg.Graphics.Clip.IsVisible(tools.Bounds))
            //{
            RectangleF rectToDraw = rect;

            if (arg.Transform != null)
            {
                var ltrb = new PointF[] { rect.Location, new PointF(rect.Right, rect.Bottom) };
                arg.Transform.TransformPoints(ltrb);
                rectToDraw = RectangleF.FromLTRB(ltrb[0].X, ltrb[0].Y, ltrb[1].X, ltrb[1].Y);
            }
            if (tools.DrawingBrush != Brushes.Transparent)
            {
                arg.Graphics.FillEllipse(tools.DrawingBrush, rectToDraw);
            }
            arg.Graphics.DrawEllipse(tools.DrawingPen, rectToDraw);

            //}
        }
コード例 #6
0
        /// <summary>
        /// 渲染一次
        /// </summary>
        protected override void OnRendering(RectangleF clip)
        {
            __graphics.Clear(Configuration.BackgroundColor);
            if (Configuration.ScaleLineWidth)
            {
                __graphics.Transform = Configuration.TransformMatrix;
            }

            DrawingArgs state = default(DrawingArgs);

            if (Configuration.ScaleLineWidth)
            {
                state = new DrawingArgs(__graphics);
            }
            else
            {
                state = new DrawingArgs(__graphics, Configuration.TransformMatrix);
            }
            OnLayerRendering(state);

#if PerfMon
            var pts1 = new PointF[] { Point.Empty };
            Configuration.TransformMatrix.TransformPoints(pts1);
            System.Diagnostics.Debug.WriteLine($"Elements: {(string.Join(",", Configuration.TransformMatrix.Elements))}");
            System.Diagnostics.Debug.WriteLine($"Tranformed:{pts1[0]}");
#endif
            //__graphics.Flush(FlushIntention.Flush);
            if (DOUBLE_BUFFERED)
            {
                __bufferedGraphics.Render();
            }
            if (!__initialized)
            {
                __initialized = true;
            }
        }