ImagePathDesignerActionList
Smart-tag for image-enabled controls -- single Image section with ImagePath property, Select/Link, Browse/Embed, and Clear image actions
Table of Contents
Overview
Namespace: TheTechIdea.Beep.Winform.Controls.Design.Server.ActionLists
Inheritance: DesignerActionList | Visibility: internal sealed
ImagePathDesignerActionList provides a compact image-management smart-tag for any image-enabled control (buttons, picture boxes, panels with background images). It requires the hosting designer to implement IImagePathDesignerHost -- an interface declaring SelectImage(), ClearImage(), EmbedImage(), GetImagePath(), SetImagePath(). All items appear under a single "Image" header section.
IImagePathDesignerHost
internal interface IImagePathDesignerHost
{
void SelectImage(); // Select/link an existing image file
void ClearImage(); // Clear the current image
void EmbedImage(); // Browse and embed an image as project resource
string GetImagePath(); // Get current image path
void SetImagePath(string path); // Set image path
}Smart-Tag Items
| Section | Type | Name | Label | Description |
|---|---|---|---|---|
| Image | Property | ImagePath | Image Path | Get/set the current image file path. Delegates to _host.GetImagePath()/_host.SetImagePath(). |
| Image | Action | SelectImage | Select / Link Image... | Opens a file browser to select or link an existing image file. Delegates to _host.SelectImage(). |
| Image | Action | EmbedImage | Browse and Embed Image... | Opens a file browser and embeds the chosen image as a project resource. Delegates to _host.EmbedImage(). |
| Image | Action | ClearImage | Clear Image | Removes the current image. Delegates to _host.ClearImage(). |
Examples
// At design time, any image-enabled control shows:
// Smart-tag > Image section > "Select / Link Image..."
// -> Opens file dialog to pick icon.png
// -> Sets ImagePath = "Icons/icon.png"
// Smart-tag > Image section > "Browse and Embed Image..."
// -> Opens file dialog, embeds as project resource
// -> Sets ImagePath and adds to .resx file
// Implementing IImagePathDesignerHost in a custom designer:
public class MyImageDesigner : ControlDesigner, IImagePathDesignerHost
{
public void SelectImage() { /* show file dialog, set path */ }
public void ClearImage() { /* clear ImagePath property */ }
public void EmbedImage() { /* browse, add to resx, set path */ }
public string GetImagePath() => ((MyControl)Component).ImagePath;
public void SetImagePath(string p) => ((MyControl)Component).ImagePath = p;
}