Этот пример является устаревшим, посмотрите множество других обновлённых примеров в данной категории. This example shows how to add a Custom Component to the Designer. For this, you should create a new class of the Custom Component. For example, create the MyCustomComponent class inherited from the StiComponent. Also define the Border and Brush properties for the new component:
[StiToolbox(true)]
[StiContextTool(typeof(IStiShift))]
[StiContextTool(typeof(IStiGrowToHeight))]
[StiV1Builder(typeof(MyCustomComponentV1Builder))]
[StiV2Builder(typeof(MyCustomComponentV2Builder))]
[StiWpfPainter(typeof(MyCustomComponentWpfPainter))]
public class MyCustomComponent : StiComponent, IStiBorder, IStiBrush
{
	#region StiComponent override
	/// <summary>
	/// Gets value to sort a position in the toolbox.
	/// </summary>
	public override int ToolboxPosition
	{
		get
		{
			return 500;
		}
	}
	
	public override StiToolboxCategory ToolboxCategory
	{
		get
		{
			return StiToolboxCategory.Components;
		}
	}
	
	/// <summary>
	/// Gets a localized name of the component category.
	/// </summary>
	public override string LocalizedCategory
	{
		get
		{
			return StiLocalization.Get("Report", "Components");
		}
	}
	
	/// <summary>
	/// Gets a localized component name.
	/// </summary>
	public override string LocalizedName
	{
		get
		{
			return "MyCustomComponent1";
		}
	}
	#endregion
	
	#region IStiBorder
	private StiBorder border = new StiBorder();
	/// <summary>
	/// Gets or sets frame of the component.
	/// </summary>
	[StiCategory("Appearance")]
	[StiSerializable]
	[Description("Gets or sets frame of the component.")]
	public StiBorder Border
	{
		get
		{
			return border;
		}
		set
		{
			border = value;
		}
	}
	#endregion
	
	#region IStiBrush
	private StiBrush brush = new StiSolidBrush(Color.Transparent);
	/// <summary>
	/// Gets or sets a brush to fill a component.
	/// </summary>
	[StiCategory("Appearance")]
	[StiSerializable]
	[Description("Gets or sets a brush to fill a component.")]
	public StiBrush Brush
	{
		get
		{
			return brush;
		}
		set
		{
			brush = value;
		}
	}
	#endregion
	
	#region this
	/// <summary>
	/// Creates a new component of the type MyCustomComponent.
	/// </summary>
	public MyCustomComponent() : this(RectangleD.Empty)
	{
	}
	
	/// <summary>
	/// Creates a new component of the type MyCustomComponent.
	/// </summary>
	/// <param name="rect">The rectangle describes size and position of the component.</param>
	public MyCustomComponent(RectangleD rect) : base(rect)
	{
		PlaceOnToolbox = true;
	}
	#endregion
}

To add the Custom Component to the Designer Toolbox, it is enough to add a class to the StiConfig.Services collection. Also, this class should be added into the StiConfig.Engine collection for its recognition of the report engine:
public Window1()
{
	StiOptions.Wpf.CurrentTheme = StiOptions.Wpf.Themes.Office2013Theme;
	
	InitializeComponent();
	AddCustomComponent();
}

private static void AddCustomComponent()
{
	StiConfig.Load();
	
	StiOptions.Engine.ReferencedAssemblies = new string[] {
		"System.Dll",
		"System.Drawing.Dll",
		"System.Windows.Forms.Dll",
		"System.Data.Dll",
		"System.Xml.Dll",
		"Stimulsoft.Base.Dll",
		"Stimulsoft.Report.Dll",
		
		#region Add reference to your assembly
		"CustomComponent.Wpf.exe"
		#endregion
	};
	
	StiConfig.Services.Add(new MyCustomComponent());
	StiConfig.Save();
}

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.