예제 #1
0
        public override object ConvertFromInvariantString(string value)
        {
            ImageSourceEx img;

            var vals = (value ?? "").Split(",");

            if (vals.Length == 1)
            {
                img = ImageSourceEx.FromFile(value);
            }
            else if (vals.Length == 5)
            {
                img = ImageSourceEx.CreateResizableImage2(vals[0], Int32.Parse(vals[1]), Int32.Parse(vals[2]), Int32.Parse(vals[3]), Int32.Parse(vals[4]));
            }
            else if (vals.Length == 6)
            {
                img = ImageSourceEx.CreateResizableImage2(vals[0], Int32.Parse(vals[1]), Int32.Parse(vals[2]), Int32.Parse(vals[3]), Int32.Parse(vals[4]), Boolean.Parse(vals[5]));
            }
            else
            {
                throw new ArgumentException(value);
            }

            return(img);
        }
예제 #2
0
        public static ImageSourceEx FromFile(string fileName)
        {
            var img = new ImageSourceEx
            {
                FileName = fileName,
            };

            return(img);
        }
예제 #3
0
        public static ImageSourceEx CreateResizableImage2(string fileName, double top, double left, double bottom, double right, bool halfresize = true)
        {
            var img = new ImageSourceEx
            {
                FileName      = fileName,
                Bottom        = bottom,
                Left          = left,
                Right         = right,
                Top           = top,
                Halfresize    = halfresize,
                HasEdgeInsets = true,
            };

            return(img);
        }