Beispiel #1
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                EmbeddedImageGraphic s = (EmbeddedImageGraphic)obj;

                info.AddBaseValueEmbedded(s, typeof(EmbeddedImageGraphic).BaseType);
                info.AddValue("Image", s._imageProxy);
            }
Beispiel #2
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                EmbeddedImageGraphic s = null != o ? (EmbeddedImageGraphic)o : new EmbeddedImageGraphic();

                info.GetBaseValueEmbedded(s, typeof(EmbeddedImageGraphic).BaseType, parent);
                s.Image = (ImageProxy)info.GetValue("Image", s);
                return(s);
            }
Beispiel #3
0
        protected override void CopyFrom(GraphicBase bfrom)
        {
            EmbeddedImageGraphic from = bfrom as EmbeddedImageGraphic;

            if (from != null)
            {
                this._imageProxy = null == from._imageProxy ? null : (ImageProxy)from._imageProxy.Clone();
            }
            base.CopyFrom(bfrom);
        }
Beispiel #4
0
 public EmbeddedImageGraphic(EmbeddedImageGraphic from)
     :
     base(from) // all is done here, since CopyFrom is virtual!
 {
 }
    public void PasteObjectsFromClipboard()
    {
      GraphDocument gd = this.Doc;
      System.Windows.Forms.DataObject dao = System.Windows.Forms.Clipboard.GetDataObject() as System.Windows.Forms.DataObject;

      string[] formats = dao.GetFormats();
      System.Diagnostics.Trace.WriteLine("Available formats:");

      if (dao.GetDataPresent("Altaxo.Graph.GraphObjectList"))
      {
        object obj = dao.GetData("Altaxo.Graph.GraphObjectList");

        // if at this point obj is a memory stream, you probably have forgotten the deserialization constructor of the class you expect to deserialize here
        if (obj is ArrayList)
        {
          ArrayList list = (ArrayList)obj;
          foreach (object item in list)
          {
            if(item is GraphicBase)
              this.ActiveLayer.GraphObjects.Add(item as GraphicBase);
          }
        }
        return;
      }
      if (dao.ContainsFileDropList())
      {
        bool bSuccess = false;
        System.Collections.Specialized.StringCollection coll = dao.GetFileDropList();
        foreach (string filename in coll)
        {
          ImageProxy img;
          try
          {
            img = ImageProxy.FromFile(filename);
            if (img != null)
            {
              SizeF size = this.ActiveLayer.Size;
              size.Width /= 2;
              size.Height /= 2;
              EmbeddedImageGraphic item = new EmbeddedImageGraphic(PointF.Empty, size, img);
              this.ActiveLayer.GraphObjects.Add(item);
              bSuccess = true;
              continue;
            }
          }
          catch (Exception)
          {
          }
        }
        if (bSuccess)
          return;
      }
    
      if (dao.GetDataPresent(typeof(System.Drawing.Imaging.Metafile)))
      {
        System.Drawing.Imaging.Metafile img = dao.GetData(typeof(System.Drawing.Imaging.Metafile)) as System.Drawing.Imaging.Metafile;
        if (img != null)
        {
          SizeF size = this.ActiveLayer.Size;
          size.Width /= 2;
          size.Height /= 2;
          EmbeddedImageGraphic item = new EmbeddedImageGraphic(PointF.Empty, size, ImageProxy.FromImage(img));
          this.ActiveLayer.GraphObjects.Add(item);
          return;
        }
      }
      if (dao.ContainsImage())
      {
        Image img = dao.GetImage();
        if (img != null)
        {
          SizeF size = this.ActiveLayer.Size;
          size.Width /= 2;
          size.Height /= 2;
          EmbeddedImageGraphic item = new EmbeddedImageGraphic(PointF.Empty, size, ImageProxy.FromImage(img));
          this.ActiveLayer.GraphObjects.Add(item);
          return;
        }
      }
    }
Beispiel #6
0
 public EmbeddedImageGraphic(EmbeddedImageGraphic from)
     :
     base(from) // all is done here, since CopyFrom is overridden
 {
 }
Beispiel #7
0
		public EmbeddedImageGraphic(EmbeddedImageGraphic from)
			:
			base(from) // all is done here, since CopyFrom is virtual!
		{
		}