示例#1
0
        protected override void UpdateSignType()
        {
            base.UpdateSignType();

            _backColor = SignTypeHandler.ConvertColor(_backColor, SignType);
            tranColor  = SignTypeHandler.ConvertColor(tranColor, SignType);
        }
示例#2
0
 protected override void UpdateSignType()
 {
     base.UpdateSignType();
     _backColor = SignTypeHandler.ConvertColor(_backColor, SignType);
     _foreColor = SignTypeHandler.ConvertColor(_foreColor, SignType);
     _textEffect.UpdateEffectColor(SignType);
 }
示例#3
0
        public ShapeLine(int zoom, Point start, Point end, int width, Color foreColor, SignType signtype)
            : this(zoom, signtype)
        {
            this._startSignPoint = start;
            this._endSignPoint   = end;

            this._borderWidth = width;
            this._borderColor = SignTypeHandler.ConvertColor(foreColor, signtype);
        }
        public void VisitDynamicVideo(ShapeDynamicVideo dynamicVideo)
        {
            Color  c   = SignTypeHandler.ConvertColor(Color.White, dynamicVideo.SignType);
            string str = string.IsNullOrEmpty(dynamicVideo.DataSource) ? "No Source" : dynamicVideo.DataSource;

            using (Brush b = new SolidBrush(c))
            {
                Graphics.DrawString(str, new Font("Tahoma", 16), b, dynamicVideo.VirtualBounds);
            }
        }
示例#5
0
 public ShapeFontBase(SignType signType)
     : base(signType)
 {
     _font                        = new FontWrapper();
     _textEffect                  = new TextEffect();
     _font.PropertyChanged       += new EventHandler <PropertyChangedEventArgs>(_font_PropertyChanged);
     _textEffect.PropertyChanged += new EventHandler <PropertyChangedEventArgs>(_textEffect_PropertyChanged);
     _foreColor                   = SignTypeHandler.ConvertColor(Color.BlueViolet, SignType);
     //_foreColor = Color.BlueViolet;
 }
示例#6
0
        public ShapeLine(int zoom, Point start, Point end, ShapePaintPropertyInfo lineInfo, SignType signtype)
            : this(zoom, signtype)
        {
            this._startSignPoint = start;
            this._endSignPoint   = end;

            this._borderColor  = SignTypeHandler.ConvertColor(lineInfo.BorderColor, signtype);
            this._borderWidth  = lineInfo.BorderWidth;
            this.LineDashStyle = lineInfo.LineDashStyle;
        }
示例#7
0
 /// <summary>
 /// Draw Image
 /// add by Michael
 /// </summary>
 private void DrawImage(Graphics g, ref Rectangle destBounds)
 {
     if (_image == null)
     {
         return;
     }
     destBounds = FormatBounds(destBounds);
     using (Image image = FormatImage(_image, new Rectangle(destBounds.X, destBounds.Y, destBounds.Width, destBounds.Height)))
         SignTypeHandler.SetOutChannel(g, image, SignType, destBounds, new Rectangle(new Point(0, 0), new Size(destBounds.Width, destBounds.Height)));
 }
示例#8
0
        public ShapeFigure(int zoom, int x, int y, int width, int height, Color lineColor, Color fillColor, bool filled, int lineWidth, DashStyle lineDashStyle, SignType signType)
            : this(signType)
        {
            _zoom        = zoom;
            _borderColor = SignTypeHandler.ConvertColor(lineColor, signType);
            FillColor    = SignTypeHandler.ConvertColor(fillColor, signType);
            Filled       = filled;
            _borderWidth = lineWidth;

            SetRectangle(x, y, width, height);
        }
示例#9
0
        public ShapeFigure(int zoom, int x, int y, int width, int height, ShapePaintPropertyInfo rectInfo, SignType signType)
            : this(signType)
        {
            _zoom         = zoom;
            _borderColor  = SignTypeHandler.ConvertColor(rectInfo.BorderColor, signType);
            LineDashStyle = rectInfo.LineDashStyle;
            FillColor     = SignTypeHandler.ConvertColor(rectInfo.FilledColor, signType);
            Filled        = rectInfo.Filled;
            _borderWidth  = rectInfo.BorderWidth;

            SetRectangle(x, y, width, height);
        }
示例#10
0
        protected override void UpdateSignType()
        {
            base.UpdateSignType();

            _backColor = SignTypeHandler.ConvertColor(_backColor, SignType);
            _foreColor = SignTypeHandler.ConvertColor(_foreColor, SignType);

            foreach (var item in _childs)
            {
                item.SignType = SignType;
            }
        }
示例#11
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;
        }
示例#12
0
        public Rectangle PaintImage(Graphics g, ref Rectangle bounds, bool isDrawToBmp)
        {
            Rectangle _destBounds = Rectangle.Empty;

            if (_image != null)
            {
                switch (_sizeMode)
                {
                case PictureBoxSizeType.StretchImage:
                    PaintStretchImage(g, ref bounds);
                    break;

                case PictureBoxSizeType.CenterImage:
                    PaintCenterImage(g, ref bounds, ref _destBounds);
                    break;

                case PictureBoxSizeType.Zoom:
                    PaintZoom(g, ref bounds, ref imageBounds, ref _destBounds);
                    break;

                default:
                    PaintDefault(g, ref bounds);
                    break;
                }
                if (_destBounds.Height == 0 || _destBounds.Width == 0)
                {
                    CreateEditImage(bounds);
                }
                else
                {
                    CreateEditImage(_destBounds);
                }
            }
            else
            {
                Color c = SignTypeHandler.ConvertColor(Color.White, SignType);
                g.DrawString("Picture", Tahoma_Font, _cache.GetSolidBrush(c), bounds);
            }
            base.DestBounds = _destBounds;
            return(_destBounds);
        }
示例#13
0
        public override void VisitImage(ShapeImage shape)
        {
            if (shape.DestBounds.Size == SizeF.Empty)
            {
                return;
            }

            if (shape._Image == null)
            {
                shape._Image = IOHelper.GetImageFromFile(shape.ImageUrl);
            }

            if (shape._Image != null)
            {
                shape.UpdateDestBounds();
                shape.DestBounds = new Rectangle(shape.DestBounds.X, shape.DestBounds.Y, shape.DestBounds.Width + 2, shape.DestBounds.Height);

                shape.InnerImage = shape.FormatImage(shape._Image, shape.DestBounds, GetFrameBounds(shape));
            }
            using (var g = Graphics.FromImage(shape.InnerImage))
                SignTypeHandler.SetOutChannel(g, shape.InnerImage, shape.SignType, new RectangleF(PointF.Empty, new SizeF(shape.InnerImage.Width, shape.InnerImage.Height)), new RectangleF(PointF.Empty, new SizeF(shape.InnerImage.Width, shape.InnerImage.Height)));

            shape.InnerImagePath = shape.SaveImage(shape.InnerImage);
        }
示例#14
0
 public Color ConveredForeColor(SignType signType)
 {
     return(SignTypeHandler.ConvertToMonoColor(_foreColor, signType));
 }
示例#15
0
 public Color ConveredBackColor(SignType signType)
 {
     return(SignTypeHandler.ConvertToMonoColor(_backColor, signType));
 }
示例#16
0
 protected override void UpdateSignType()
 {
     this.filledColor = SignTypeHandler.ConvertColor(filledColor, SignType);
     base.UpdateSignType();
 }
示例#17
0
 protected virtual void UpdateSignType()
 {
     _borderColor = SignTypeHandler.ConvertColor(_borderColor, _signType);
 }
示例#18
0
 internal void UpdateEffectColor(SignType signType)
 {
     _color = SignTypeHandler.ConvertColor(_color, signType);
 }
示例#19
0
        public Rectangle PaintImage(Graphics g, ref Rectangle bounds, bool isDrawToBmp)
        {
            Rectangle imageBounds = Rectangle.Empty;
            Rectangle destBounds  = Rectangle.Empty;
            int       width;
            int       height;
            int       x;
            int       y;

            //GraphicsUnit gu = GraphicsUnit.Pixel;
            if (_image != null)
            {
                switch (_sizeMode)
                {
                //case PictureBoxSizeType.Normal:
                //    if (_orgiBounds != Rectangle.Empty)
                //    {
                //        bounds = _orgiBounds;
                //        _orgiBounds = Rectangle.Empty;
                //    }
                //    width = bounds.Width < _image.Width ? bounds.Width : _image.Width;
                //    height = bounds.Height < _image.Height ? bounds.Height : _image.Height;
                //    destBounds = new Rectangle(bounds.Location, new Size(width, height));
                //    destBounds = FormatBoundsByZoom(destBounds, Zoom);
                //    imageBounds = new Rectangle(0, 0, width, height);
                //    break;
                //case PictureBoxSizeType.AutoSize:
                //    _orgiBounds = bounds;
                //    bounds = new Rectangle(_orgiBounds.Location, _image.Size);
                //    break;
                case PictureBoxSizeType.StretchImage:
                    if (_orgiBounds != RectangleF.Empty)
                    {
                        bounds      = _orgiBounds;
                        _orgiBounds = Rectangle.Empty;
                    }
                    destBounds = bounds;
                    break;

                case PictureBoxSizeType.CenterImage:
                {
                    Point loc = new Point();
                    if (_orgiBounds != Rectangle.Empty)
                    {
                        bounds      = _orgiBounds;
                        _orgiBounds = Rectangle.Empty;
                    }

                    width  = bounds.Width < _image.Width ? bounds.Width : _image.Width;
                    height = bounds.Height < _image.Height ? bounds.Height : _image.Height;
                    loc.X  = (_image.Width - width) / 2;
                    loc.Y  = (_image.Height - height) / 2;
                    x      = bounds.Location.X;
                    y      = bounds.Location.Y;

                    if (bounds.Width > _image.Width)
                    {
                        x += (bounds.Width - _image.Width) / 2;
                    }

                    if (bounds.Height > _image.Height)
                    {
                        y += (bounds.Height - _image.Height) / 2;
                    }

                    destBounds  = new Rectangle(x, y, width, height);
                    destBounds  = FormatBoundsByZoom(destBounds, Zoom);
                    imageBounds = new Rectangle(loc, new Size(width, height));
                    break;
                }

                case PictureBoxSizeType.Zoom:
                {
                    if (_orgiBounds != Rectangle.Empty)
                    {
                        bounds      = _orgiBounds;
                        _orgiBounds = Rectangle.Empty;
                    }
                    float wn = bounds.Width * 1f / _image.Width * 1f;
                    float hn = bounds.Height * 1f / _image.Height * 1f;
                    float n  = wn < hn ? wn : hn;
                    x          = bounds.Location.X + bounds.Width / 2 - (int)(n * _image.Width) / 2;
                    y          = bounds.Location.Y + bounds.Height / 2 - (int)(n * _image.Height) / 2;
                    destBounds = new Rectangle(x, y, (int)(n * _image.Width), (int)(n * _image.Height));
                    if (VirtualBounds.X % Zoom == 0 && VirtualBounds.Y % Zoom == 0 && VirtualBounds.Width % Zoom == 0 && VirtualBounds.Height % Zoom == 0)
                    {
                        destBounds = FormatBoundsByZoom(destBounds, Zoom);
                    }
                    break;
                }

                default:
                    break;
                }
                //DrawImage(g, bounds);
                DrawImage(g, ref destBounds);
            }
            else
            {
                Color c = SignTypeHandler.ConvertColor(Color.White, SignType);
                g.DrawString("Video", ShapeImage.Tahoma_Font, _cache.GetSolidBrush(c), bounds);
            }
            return(destBounds);
        }
示例#20
0
 public Color ConveredEffectColor(SignType signType)
 {
     return(SignTypeHandler.ConvertToMonoColor(_color, signType));
 }
示例#21
0
 /// <summary>
 /// Draw Image
 /// Updated by Louis
 /// </summary>
 private void DrawImage(Graphics g, Rectangle destRect)
 {
     destRect = FormatBounds(destRect);
     using (Image image = FormatImage(_image, destRect))
         SignTypeHandler.SetOutChannel(g, image, SignType, destRect, new Rectangle(new Point(0, 0), image.Size)); //g.DrawImage(shape, destRect, new Rectangle(new Point(0, 0), shape.Size), GraphicsUnit.Pixel);
 }