How to: Use the CustomDrawItem Event to Draw Custom Icons Inside Diagram Items
- 4 minutes to read
This example demonstrates how to use the DiagramControl.CustomDrawItem event to modify the standard drawing mechanism of diagram items (shapes, connectors, containers, etc.). In this example, a DiagramShape class descendant was created to introduce the Status property. Depending on the Status property value, a custom icon is drawn in the lower right-hand corner of a shape.
Note
The Custom
To apply custom drawing logic defined in the Diagram
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace XtraDiagram.CustomDraw {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}