Exemple #1
0
        internal void PaintImageInShape(Graphics g)
        {
            List <Image>  imagesActual = new List <Image>();
            List <Image>  images       = new List <Image>();
            List <string> strings      = new List <string>();

            bool isReturnImage = FontMgr.GenerateBmps(imagesActual, images, strings);

            if (!isReturnImage)
            {
                return;
            }
            //Create shape
            Image image;

            image = images[0];
            //shape.Save("C:\\a.png",ImageFormat.Png);
            Font.FontFileName = FontMgr.FontFileName;
            if (FrameSizeFixed)
            {
                Font.Size = FontMgr.FontHeight / Zoom;
            }

            if (FontMgr.Bold)
            {
                Font.Style = Font.Style | FontStyle.Bold;
            }
            else
            {
                Font.Style = Font.Style & ((FontStyle.Bold | FontStyle.Italic | FontStyle.Strikeout | FontStyle.Underline) ^ FontStyle.Bold);
            }

            if (FontMgr.Italic)
            {
                Font.Style = FontStyle.Italic;
            }
            else
            {
                Font.Style = Font.Style & ((FontStyle.Bold | FontStyle.Italic | FontStyle.Strikeout | FontStyle.Underline) ^ FontStyle.Italic);
            }
            //Label shape
            _labelImage       = image;
            _labelImageActual = imagesActual[0];

            if (g == null) //get _labelImage, and _labelImageActual then exit
            {
                return;
            }
            Rectangle imageRectangle = new Rectangle(VirtualBounds.X, VirtualBounds.Y, image.Width, image.Height);

            VirtualBounds = imageRectangle;
            g.DrawImage(image, new Rectangle(VirtualBounds.X, VirtualBounds.Y, image.Width, image.Height));
            this._paintAction = PaintActionType.None;
        }
Exemple #2
0
        public ShapeLabel(SignType signType) : base(signType)
        {
            //_refCount++;
            _paintAction = PaintActionType.FrameFontSizeStyle;
            _text        = DefaultText;
            _stringFormat.FormatFlags = StringFormatFlags.DisplayFormatControl;
            _stringFormat.Alignment   = StringAlignment.Center;
            _foreColor = SignTypeHandler.ConvertColor(Color.BlueViolet, SignType);
            //_backColor = SignTypeHandler.ConvertColor(Color.Transparent, SignType);

            _font.Name = FontManager.GetProWriteFonts()[0];
            _font.Size = 7;
        }
Exemple #3
0
 /// <summary>
 /// Function: Set text outline or shadow or BubbleSurround or none
 /// Author  : Jerry Xu
 /// Date    : 2008-8-12
 /// </summary>
 private void SetOutlineShadow()
 {
     if (_outlineshadow == OutlineShadowType.NONE)
     {
         _paintAction = PaintActionType.None;
     }
     else if (_outlineshadow == OutlineShadowType.OUTLINE)
     {
         _paintAction = PaintActionType.OutLine;
     }
     else if (_outlineshadow == OutlineShadowType.SHADED)
     {
         _paintAction = PaintActionType.Shadow;
     }
     else if (_outlineshadow == OutlineShadowType.BubbleSurround)
     {
         _paintAction = PaintActionType.BubbleSurround;
     }
 }
Exemple #4
0
        public override void FromTo(ShapeBase shape)
        {
            base.FromTo(shape);

            ShapeLabel other = shape as ShapeLabel;

            if (other != null)
            {
                _text = other._text;
                //_autofittype = other._autofittype;
                _kernAmount    = other._kernAmount;
                _leadAmount    = other._leadAmount;
                _outlineshadow = other._outlineshadow;
                _paintAction   = other._paintAction;
                _textAlign     = other._textAlign;
                _textVAlign    = other._textVAlign;
                _wordWrap      = other._wordWrap;
                _paintAction   = PaintActionType.None;
                if (other._labelImage != null)
                {
                    if (other._innerImagePath != null && other._innerImagePath != string.Empty)
                    {
                        IOHelper.RemoveFile(other._innerImagePath);
                    }
                    _labelImage           = other._labelImage.Clone() as Image;
                    other._innerImagePath = SaveTextImage(_labelImage);
                    _innerImagePath       = other._innerImagePath;
                }
                else
                {
                    _innerImagePath = other._innerImagePath;
                }
                _frameSizeFixed = other.FrameSizeFixed;
                _fontSizeFixed  = other.FontSizeFixed;

                _backColor = other.BackColor;
            }
        }