예제 #1
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                return(RadImageShape.Serialize(value as RadImageShape));
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
예제 #2
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                return(RadImageShape.Deserialize((string)value));
            }

            return(base.ConvertFrom(context, culture, value));
        }
예제 #3
0
        public static string Serialize(RadImageShape shape)
        {
            if (shape == null)
            {
                return(string.Empty);
            }
            MemoryStream  memoryStream  = new MemoryStream();
            XmlTextWriter xmlTextWriter = new XmlTextWriter((Stream)memoryStream, Encoding.UTF8);

            new XmlSerializer(typeof(RadImageShape)).Serialize((XmlWriter)xmlTextWriter, (object)shape);
            xmlTextWriter.Flush();
            string base64String = Convert.ToBase64String(memoryStream.ToArray());

            xmlTextWriter.Close();
            memoryStream.Close();
            return(base64String);
        }
예제 #4
0
        public object Clone()
        {
            RadImageShape radImageShape = new RadImageShape();

            if (this.image != null)
            {
                radImageShape.image = this.image.Clone() as Image;
            }
            radImageShape.alpha             = this.alpha;
            radImageShape.interpolationMode = this.interpolationMode;
            radImageShape.margins           = this.margins;
            radImageShape.padding           = this.padding;
            radImageShape.paintMode         = this.paintMode;
            radImageShape.rotateFlip        = this.rotateFlip;
            radImageShape.useSegments       = this.useSegments;
            radImageShape.visibleSegments   = this.visibleSegments;
            return((object)radImageShape);
        }
예제 #5
0
        public static RadImageShape Deserialize(string state)
        {
            if (string.IsNullOrEmpty(state))
            {
                return(null);
            }

            byte[]        bytes      = Convert.FromBase64String(state);
            MemoryStream  stream     = new MemoryStream(bytes);
            XmlTextReader reader     = new XmlTextReader(stream);
            XmlSerializer serializer = new XmlSerializer(typeof(RadImageShape));

            RadImageShape shape = serializer.Deserialize(reader) as RadImageShape;

            reader.Close();
            stream.Close();

            return(shape);
        }
예제 #6
0
        public object Clone()
        {
            RadImageShape cloning = new RadImageShape();

            if (this.image != null)
            {
                cloning.image = this.image.Clone() as Image;
            }

            cloning.alpha             = this.alpha;
            cloning.interpolationMode = this.interpolationMode;
            cloning.margins           = this.margins;
            cloning.padding           = this.padding;
            cloning.paintMode         = this.paintMode;
            cloning.rotateFlip        = this.rotateFlip;
            cloning.useSegments       = this.useSegments;
            cloning.visibleSegments   = this.visibleSegments;

            return(cloning);
        }
예제 #7
0
        public static string Serialize(RadImageShape shape)
        {
            if (shape == null)
            {
                return(string.Empty);
            }

            MemoryStream  stream     = new MemoryStream();
            XmlTextWriter writer     = new XmlTextWriter(stream, Encoding.UTF8);
            XmlSerializer serializer = new XmlSerializer(typeof(RadImageShape));

            serializer.Serialize(writer, shape);
            writer.Flush();

            string state = Convert.ToBase64String(stream.ToArray());

            writer.Close();
            stream.Close();

            return(state);
        }
예제 #8
0
 public RadImageShapeEditorControl(RadImageShape shape)
 {
     this.shape          = shape;
     this.ResizeRedraw   = true;
     this.DoubleBuffered = true;
 }