public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType) { if (destType == typeof(string) && value is ImageTable) { // Cast the value to an Employee type ImageTable emp = (ImageTable)value; // Return department and department role separated by comma. return(emp.ToString()); } return(base.ConvertTo(context, culture, value, destType)); }
/// <summary> /// Removes an employee object from the collection /// </summary> /// <param name="emp"></param> public void Remove(ImageTable emp) { this.List.Remove(emp); }
/// <summary> /// Adds an employee object to the collection /// </summary> /// <param name="emp"></param> public void Add(ImageTable emp) { this.List.Add(emp); }
private void Paint(object sender, PaintEventArgs e) { if (Enable) { ImageTable currImageTable = null; foreach (ImageTable imageTable in _imageTableCollection) { if (getResult(imageTable.Expression, _parent.FindForm() as IFrmTagGroup).ToString().Equals("True")) { currImageTable = imageTable; break; } } ColorTable currCorTable = null; foreach (ColorTable colorTable in _colorTableCollection) { if (getResult(colorTable.Expression, _parent.FindForm() as IFrmTagGroup).ToString().Equals("True")) { currCorTable = colorTable; break; } } Bitmap image = null; if (currImageTable != null) { image = new Bitmap(currImageTable.Image); } else { if (_parent.BackgroundImage != null) { image = new Bitmap(_parent.BackgroundImage); } } if (TransparentColor != null && TransparentColor != Color.Empty && image != null) { image.MakeTransparent(TransparentColor); } ColorMap[] colorMap = null; ImageAttributes attr = null; if (currCorTable != null) { colorMap = new ColorMap[1]; colorMap[0] = new ColorMap(); colorMap[0].OldColor = _oldColor; colorMap[0].NewColor = currCorTable.NewColor; // Set the image attribute's color mappings attr = new ImageAttributes(); attr.SetRemapTable(colorMap); } e.Graphics.InterpolationMode = InterpolationMode.Low; e.Graphics.SmoothingMode = SmoothingMode.HighSpeed; e.Graphics.CompositingMode = CompositingMode.SourceOver; e.Graphics.CompositingQuality = CompositingQuality.HighSpeed; if (image != null) { if (attr != null) { e.Graphics.DrawImage(image, _parent.ClientRectangle, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, attr); } else { e.Graphics.DrawImage(image, _parent.ClientRectangle); } } } }