Exemplo n.º 1
0
        public void VisitLabel(ShapeLabel shape)
        {
            if (shape.Text != null && shape.Text.Length > 0)
            {
                if (shape.IsChanged || shape.LabelImage == null) //has new text paint shape
                {
                    if (shape.FrameSizeFixed)
                    {
                        shape.FontMgrSetup(true, false, ShapeLabel.DrawMode.Normal);
                    }
                    else
                    {
                        shape.FontMgrSetup(true, true, ShapeLabel.DrawMode.Normal);
                    }

                    shape.PaintImageInShape(Graphics);
                    shape.IsChanged = false;
                }
                else
                {
                    Graphics.DrawImage(shape.LabelImage, new Rectangle(shape.VirtualInnerBounds.X - shape.BorderWidth, shape.VirtualInnerBounds.Y - shape.BorderWidth, shape.LabelImage.Width, shape.LabelImage.Height));
                }
            }
        }
Exemplo n.º 2
0
        public override void VisitLabel(ShapeLabel shape)
        {
            if (!shape.IsChanged ||
                string.IsNullOrEmpty(shape.Text))
            {
                return;
            }

            if (shape.LabelImage == null) //has new text paint shape
            {
                if (shape.FrameSizeFixed)
                {
                    shape.FontMgrSetup(true, false, ProWrite.Entity.Shape.ShapeLabel.DrawMode.Play);
                }
                else
                {
                    shape.FontMgrSetup(true, true, ProWrite.Entity.Shape.ShapeLabel.DrawMode.Play);
                }

                using (var g = GetGraphics())
                    shape.PaintImageInShape(g);
                shape.IsChanged = false;
            }
            else
            {
                using (var g = GetGraphics())
                    g.DrawImage(shape.LabelImage, new Rectangle(shape.VirtualInnerBounds.X - shape.BorderWidth, shape.VirtualInnerBounds.Y - shape.BorderWidth, shape.LabelImage.Width, shape.LabelImage.Height));
            }

            if (shape.LabelImage != null)
            {
                using (Bitmap bit = new Bitmap(shape.LabelImage))
                    shape.InnerImagePath = shape.SaveImage(bit);
            }
            shape.IsChanged = true;
        }