/// <summary>
        ///
        /// </summary>
        /// <param name="value"></param>
        /// <param name="formatInfo"></param>
        /// <param name="gridElement"></param>
        /// <returns></returns>
        protected override Image GetImageCore(object value, CellImageFormatInfo formatInfo, GridElement gridElement)
        {
            if (m_images.Count == 0)
            {
                return(null);
            }

            Image ret = null;

            if ((value != null) && (value != DBNull.Value) && (value != formatInfo.NullValue))
            {
                string[] ss = value.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string s in ss)
                {
                    if (m_images.ContainsKey(s))
                    {
                        Image image = Feng.Windows.Utils.ImageHelper.DrawImageBackgound(m_images[s], Color.White, imageWidth, imageHeight);
                        if (ret == null)
                        {
                            ret = image;
                        }
                        else
                        {
                            ret = Feng.Windows.Utils.ImageHelper.ConcatImage(ret, image, Feng.Windows.Utils.ImageHelper.ImageConcatType.Horizontal);
                        }
                    }
                }
            }
            return(ret);
        }
Esempio n. 2
0
        protected override Image GetImageCore(object value, CellImageFormatInfo formatInfo, GridElement gridElement)
        {
            string s = (string)value;

            if (string.IsNullOrEmpty(s))
            {
                return(null);
            }
            string[] ss = s.Split(new char[] { '/', '-' }, StringSplitOptions.RemoveEmptyEntries);
            if (ss.Length < 1)
            {
                return(null);
            }
            int?idx = ConvertHelper.ToInt(ss[0]);

            if (!idx.HasValue)
            {
                return(null);
            }

            Image image = new Bitmap(16, 16);
            //image = ImageHelper.DrawImageBackgound(image, Color.White, 16, 16);
            Graphics g = Graphics.FromImage(image);

            g.FillEllipse(new SolidBrush(m_colors[idx.Value % m_colors.Length]), 0, 0, image.Width, image.Height);

            return(image);
        }
        protected override Image GetImageCore(object value, CellImageFormatInfo formatInfo, GridElement gridElement)
        {
            if (value == null)
                return null;

            if (!Convert.ToBoolean(value))
                return Feng.Windows.ImageResource.Get(m_startImage).Reference;
            else
                return Feng.Windows.ImageResource.Get(m_stopImage).Reference;
        }
        protected override Image GetImageCore(object value, CellImageFormatInfo formatInfo, GridElement gridElement)
        {
            if (value == null)
            {
                return(null);
            }

            if (!Convert.ToBoolean(value))
            {
                return(Feng.Windows.ImageResource.Get(m_startImage).Reference);
            }
            else
            {
                return(Feng.Windows.ImageResource.Get(m_stopImage).Reference);
            }
        }
        protected override Image GetImageCore(object value, CellImageFormatInfo formatInfo, GridElement gridElement)
        {
            string s = (string)value;
            if (string.IsNullOrEmpty(s))
                return null;
            string[] ss = s.Split(new char[] { '/', '-' }, StringSplitOptions.RemoveEmptyEntries);
            if (ss.Length < 1)
                return null;
            int? idx = ConvertHelper.ToInt(ss[0]);
            if (!idx.HasValue)
                return null;

            Image image = new Bitmap(16, 16);
            //image = ImageHelper.DrawImageBackgound(image, Color.White, 16, 16);
            Graphics g = Graphics.FromImage(image);
            g.FillEllipse(new SolidBrush(m_colors[idx.Value % m_colors.Length]), 0, 0, image.Width, image.Height);

            return image;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="formatInfo"></param>
        /// <param name="gridElement"></param>
        /// <returns></returns>
        protected override Image GetImageCore(object value, CellImageFormatInfo formatInfo, GridElement gridElement)
        {
            if (m_images.Count == 0)
            {
                return null;
            }

            Image ret = null;
            if ((value != null) && (value != DBNull.Value) && (value != formatInfo.NullValue))
            {
                string[] ss = value.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string s in ss)
                {
                    if (m_images.ContainsKey(s))
                    {
                        Image image = Feng.Windows.Utils.ImageHelper.DrawImageBackgound(m_images[s], Color.White, imageWidth, imageHeight);
                        if (ret == null)
                        {
                            ret = image;
                        }
                        else
                        {
                            ret = Feng.Windows.Utils.ImageHelper.ConcatImage(ret, image, Feng.Windows.Utils.ImageHelper.ImageConcatType.Horizontal);
                        }
                    }
                }
            }
            return ret;
        }