Hello -
You can do this by creating a class that implements ILegendItemSouce and drawing the solid color in the the DrawLegendItem method. Your code might look similar to the following:
class SolidColorLegendItemSource : ILegendItemSource
{
private Color itemColor;
public SolidColorLegendItemSource(Color color)
{
itemColor = color;
}
public void DrawLegendItem(ComponentDrawArgs args)
{
// create the bounds for the solid fill rectangle
int top = args.Bounds.Height / 2 + args.Bounds.Y - args.Bounds.Height / 4;
int height = args.Bounds.Height / 2;
int left = args.Bounds.X;
int width = args.Bounds.Height;
args.Graphics.FillRectangle(new SolidBrush(itemColor), new Rectangle(new Point(left, top), new Size (width, height)));
}
public event EventHandler Disposed;
protected virtual void OnDisposed(EventArgs e)
{
if (Disposed != null)
Disposed(this, e);
}
public event EventHandler LegendItemChanged;
protected virtual void OnLegendItemChanged(EventArgs e)
{
if (LegendItemChanged != null)
LegendItemChanged(this, e);
}
}

Let me know if you have any questions -
NickB
National Instruments