Overview

BeepMediaWidget is a paint-based WinForms widget that inherits from BaseControl. It uses an IWidgetPainter pipeline to render rich visuals without child controls. The Style property selects one of 10 built-in render modes; changing it at runtime immediately swaps the painter and triggers a repaint.

Toolbox icon: 🖼️
Category: Beep Widgets → Media / Images
Default size: 280 × 200
Namespace: TheTechIdea.Beep.Winform.Controls.Widgets

Key Features

🖼️ Ten Media Styles

Images, galleries, avatars, icons — one widget covers every media type.

🎭 Overlay Support

Built-in text overlay with ShowOverlay toggle for ImageCard/ImageOverlay.

👤 Avatar Clusters

AvatarGroup renders stacked circular thumbnails with overflow count badge.

🎨 Theme Consistent

Border, accent, and hover colours derive automatically from the active theme.

🖱️ Per-Item Events

ImageClicked and AvatarClicked carry individual item data for drill-down.

📐 Gallery & Grid

MediaGallery and PhotoGrid handle multi-image layouts internally.

Style Variants (10)

Style ValueDescription
ImageCardCard with a background image and an overlay text strip.
AvatarGroupStacked circular avatar thumbnails for group display.
IconCardLarge centred icon with a title and description below.
MediaGalleryHorizontally scrollable image carousel.
ProfileCardUser profile card with photo, name, role, and stats.
ImageOverlayFull-bleed image with a semi-transparent text overlay.
PhotoGridMasonry-style grid of photo thumbnails.
MediaViewerSingle large media item with title and metadata.
AvatarListVertical list of avatars with name and subtitle labels.
IconGridGrid of icons with labels — ideal for feature showcases.

Properties

PropertyTypeDefaultDescription
StyleMediaWidgetStyleImageCardSelects the media painter.
Titlestring"Media Title"Primary caption or heading.
Subtitlestring"Subtitle"Secondary caption.
ImagePathstring""File path to the primary display image.
ImageImagenullDirectly assigned Image object (takes priority over ImagePath).
MediaItemsList<MediaItem>(empty)Collection for gallery, grid, and group styles.
ShowOverlaybooltrueShow/hide the text overlay on ImageCard/ImageOverlay.
OverlayTextstring"Overlay Text"Text rendered in the overlay strip.
AccentColorColor(theme primary)Accent for icon colours and selection borders.

Inherits all BaseControl properties (Border, Padding, Theme colors, etc.).

Events

EventArgs TypeDescription
MediaClickedBeepEventDataArgsFired when anywhere on the widget is clicked.
ImageClickedBeepEventDataArgsFired when a specific image/thumbnail is clicked. Data contains MediaItem or index.
AvatarClickedBeepEventDataArgsFired when an avatar is clicked in AvatarGroup or AvatarList styles.
OverlayClickedBeepEventDataArgsFired when the overlay text area is clicked.

Basic Usage

// Profile card
var profile = new BeepMediaWidget
{
    Style    = MediaWidgetStyle.ProfileCard,
    Title    = "Sarah Connor",
    Subtitle = "Lead Designer",
    ImagePath = "avatars/sarah.png",
    Size     = new Size(240, 180)
};

// Icon grid
var icons = new BeepMediaWidget
{
    Style      = MediaWidgetStyle.IconGrid,
    Title      = "Quick Access",
    MediaItems = new List
    {
        new MediaItem { Title = "Reports",    IconPath = "icons/report.svg"    },
        new MediaItem { Title = "Settings",   IconPath = "icons/settings.svg"  },
        new MediaItem { Title = "Team",       IconPath = "icons/team.svg"      },
        new MediaItem { Title = "Analytics",  IconPath = "icons/analytics.svg" },
    },
    Size = new Size(320, 160)
};

Event Handling

icons.ImageClicked += (s, e) =>
{
    var item = (MediaItem)e.Data;
    NavigateTo(item.Title);
};

Best Practices

  • Set Style before adding the widget to the form to avoid double repaints.
  • Adjust Size to fit your layout — defaults are minimum comfortable sizes.
  • Read BeepEventDataArgs.Data in event handlers for context-specific click data.
  • Call Invalidate() after updating data properties to trigger a repaint.
  • Let theme colors flow from BeepStyling.CurrentTheme — avoid overriding color properties unless customization is explicitly desired.