New to Telerik UI for WinForms? Download free 30-day trial

Information Adorner

RadDiagram shows information tool-tips that appear below the manipulation adorner when you resize, rotate or drag a shape or group of shapes and connections.

RadDiagram uses the ItemInformationAdorner to visualize information regarding the position, size and rotation angle of its shapes.

this.radDiagram1.IsInformationAdornerVisible = true;

Fig.1 visualizes the X and Y component of the current position of the shape when moving. It also visualizes the angle that the shape is rotated to and the current Width and Height of the corresponding shape when resizing.

Figure 1: Information Adorner

WinForms RadDiagram Information Adorner

Custom ItemInformationAdorner

ItemInformationAdorner can be customized in order to display additional elements, e.g. a button. To achieve it, you should create a derivative of the Telerik.WinControls.UI.Diagrams.Primitives.ItemInformationAdorner class and override its CreateChildElements method. Here is demonstrated a sample code snippet:


class MyItemInformationAdorner : Telerik.WinControls.UI.Diagrams.Primitives.ItemInformationAdorner
{
    public MyItemInformationAdorner(RadDiagramElement diagram)
    {
        this.Diagram = diagram;
    }

    protected override void CreateChildElements()
    {
        base.CreateChildElements();
        RadButtonElement button = new RadButtonElement() { Text = "Click me!", AutoSize = true, TextAlignment = ContentAlignment.MiddleRight };
        this.InformationTipPanel.Children.First().Visibility = ElementVisibility.Collapsed;
        this.InformationTipPanel.Children.Add(button);
        button.ButtonFillElement.BackColor = System.Drawing.Color.Red;
        button.ButtonFillElement.GradientStyle = GradientStyles.Solid;
        button.Click += button_Click;
    }
    void button_Click(object sender, EventArgs e)
    {
        MessageBox.Show("Hello");
    }
}

Now, you should apply the custom ItemInformationAdorner to DiagramElement:

this.radDiagram1.DiagramElement.ItemInformationAdorner = new MyItemInformationAdorner(this.radDiagram1.DiagramElement);
Telerik.WinControls.UI.Diagrams.Primitives.ItemInformationAdorner item = this.radDiagram1.DiagramElement.ItemInformationAdorner;
item.Width = 100;
item.Height = 20;

Figure 2: Custom Information Adorner

WinForms RadDiagram Custom Information Adorner

In this article