Exemple #1
0
        /// <summary>
        /// Clones the shape.
        /// </summary>
        /// <returns></returns>
        public override object Clone()
        {
            var img = new Image();

            img.Bitmap   = this.Bitmap.Clone() as Bitmap;
            img.Selected = Selected;
            img.Locked   = Locked;
            img.Geometric.AddRectangle(Geometric.GetBounds());
            img.IsEdited         = IsEdited;
            img.Visible          = Visible;
            img.Appearance.Image = img.Bitmap;
            img.Tag = Tag;
            return(img);
        }
Exemple #2
0
        public override object Clone()
        {
            var NewBgImage = new BodyBackground();

            if (Bitmap != null)
            {
                // if (Dimension.Width == 1 && Dimension.Height == 1)
                if (Dimension.IsEmpty)
                {
                    NewBgImage.Geometric.AddRectangle(new System.Drawing.Rectangle(0, 0, Bitmap.Width, Bitmap.Height));
                }
                else
                {
                    //  var rec = Geometric.GetBounds();
                    NewBgImage.Geometric.AddRectangle(Geometric.GetBounds());
                }


                // Dimension = new SizeF(bitmap.Width, bitmap.Height);
                NewBgImage.Location = Location;
                NewBgImage.Locked   = Locked;
                NewBgImage.Selected = Selected;
                NewBgImage.Rotation = Rotation;
                NewBgImage.Tag      = Tag;
                NewBgImage.Visible  = Visible;
                // Bitmap.Save("d:\\4545.jpg");

                // اگر دوخط زیر را حذف کنیم هنگام چرخاندن یا ذخیره نمودن تصویر پیغام خطا ظاهر خواهد شد مانند 5 خط پایین تر که سعی می شود در آن تصویر چرخانده شود

                //  Bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
                //Bitmap.RotateFlip(RotateFlipType.Rotate90FlipXY);

                NewBgImage.Bitmap = Bitmap.Clone() as Bitmap;

                try
                {
                    // Bitmap.Save("d:\\4545.jpg");
                    // Bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
                    //  NewBgImage.Bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
                }
                catch (Exception)
                {
                }

                NewBgImage.Appearance.Image = NewBgImage.Bitmap;
            }
            return(NewBgImage);
        }
Exemple #3
0
        /// <summary>
        /// Paint function
        /// </summary>
        /// <param name="document">Informations transferred from DrawingPanel</param>
        /// <param name="e">PaintEventArgs</param>
        public override void Paint(IDocument document, PaintEventArgs e)
        {
            if (!Visible)
            {
                return;
            }

            e.Graphics.FillRectangle(_brush, System.Drawing.Rectangle.Round(new System.Drawing.RectangleF(Location, Dimension)));
            e.Graphics.DrawRectangle(System.Drawing.Pens.Black, System.Drawing.Rectangle.Round(Geometric.GetBounds()));
        }
Exemple #4
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public Text()
 {
     Geometric.AddString(_displayedText, _font.FontFamily, (int)_font.Style, _font.Size, Geometric.GetBounds(), _stringFormat);
     this.Transformer.RotateOccurred += new RotateHandler(Transformer_RotateOccurred);
 }
Exemple #5
0
        virtual protected void UpdateText()
        {
            SizeF  oldDimension = Dimension;
            PointF oldLocation  = Location;
            float  oldRotation  = Rotation;

            Geometric.Reset();
            Geometric.AddString(_displayedText, _font.FontFamily, (int)_font.Style, _font.Size, Geometric.GetBounds(), _stringFormat);

            System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix();
            matrix.Rotate(_degree);
            Geometric.Transform(matrix);

            if (_degree != oldRotation)
            {
                base.Rotation = _degree;
            }

            base.Dimension = oldDimension;
            base.Location  = oldLocation;
        }
Exemple #6
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="text">Text to view.</param>
        /// <param name="font">Text font.</param>
        /// <param name="stringFormat">String format text.</param>
        public Text(string text, Font font, StringFormat stringFormat)
        {
            if (text != string.Empty)
            {
                _displayedText = text;
            }

            _font         = font;
            _stringFormat = stringFormat;

            Geometric.AddString(text, _font.FontFamily, (int)_font.Style, _font.Size, Geometric.GetBounds(), _stringFormat);

            this.Transformer.RotateOccurred += new RotateHandler(Transformer_RotateOccurred);
        }
Exemple #7
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="text">Text to view.</param>
        /// <param name="font">Text font.</param>
        /// <param name="stringFormat">String format text.</param>
        public Text(string text, Font font, StringFormat stringFormat)
        {
            if (text != string.Empty)
            {
                _displayedText = text;
            }
            this.Locked   = true;
            _font         = font;
            _stringFormat = stringFormat;

            Geometric.AddString(text, _font.FontFamily, (int)_font.Style, _font.Size, Geometric.GetBounds(), _stringFormat);
            //  Geometric.FillMode = System.Drawing.Drawing2D.FillMode.Winding;

            this.Transformer.RotateOccurred += new RotateHandler(Transformer_RotateOccurred);
        }