public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { ImageOverlay imageOverlay = value as ImageOverlay; if (imageOverlay != null) { if (imageOverlay.Image == null) { return("(none)"); } else { return("(set)"); } } TextOverlay textOverlay = value as TextOverlay; if (textOverlay != null) { if (String.IsNullOrEmpty(textOverlay.Text)) { return("(none)"); } else { return("(set)"); } } } return(base.ConvertTo(context, culture, value, destinationType)); }
TextOverlay GenerateOverlay() { TextOverlay ov = new TextOverlay(); ov.Alignment = ContentAlignment.MiddleCenter; ov.TextColor = Color.White; ov.BackColor = Color.GreenYellow; ov.BorderColor = Color.Black; ov.BorderWidth = 4.0f; ov.Font = new Font("Segoe UI", 36); ov.Text = "Loading..."; return ov; }
/// <summary> /// Create and configure the empty list msg overlay /// </summary> protected virtual void InitializeEmptyListMsgOverlay() { TextOverlay textOverlay = new TextOverlay(); textOverlay.Alignment = System.Drawing.ContentAlignment.MiddleCenter; textOverlay.TextColor = SystemColors.ControlDarkDark; textOverlay.BackColor = Color.BlanchedAlmond; textOverlay.BorderColor = SystemColors.ControlDark; textOverlay.BorderWidth = 2.0f; this.EmptyListMsgOverlay = textOverlay; }
/// <summary> /// Initialize the standard image and text overlays /// </summary> protected virtual void InitializeStandardOverlays() { OverlayImage = new ImageOverlay(); AddOverlay(OverlayImage); OverlayText = new TextOverlay(); AddOverlay(OverlayText); }