Imports agLegendNET.agLegend.AGLegendModalStateConstants, agLegendNET.agLegend.AGLegendCaptionBackStyle, agLegendNET.agLegend.AGLegendShapesStyleConstants

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()

        'This call is required by the Windows Form Designer.

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
            End If
        End If
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer. 
    'Do not modify it using the code editor.
    Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
    Friend WithEvents AgLegend1 As agLegendNET.agLegend
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.LinkLabel1 = New System.Windows.Forms.LinkLabel()
        Me.AgLegend1 = New agLegendNET.agLegend(Me.components)
        Me.LinkLabel1.Anchor = (System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom)
        Me.LinkLabel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.LinkLabel1.Location = New System.Drawing.Point(32, 24)
        Me.LinkLabel1.Name = "LinkLabel1"
        Me.LinkLabel1.Size = New System.Drawing.Size(240, 152)
        Me.LinkLabel1.TabIndex = 2
        Me.LinkLabel1.TabStop = True
        Me.LinkLabel1.Text = "LinkLabel1"
        Me.AgLegend1.BackColor = System.Drawing.Color.White
        Me.AgLegend1.CaptionBackColor = System.Drawing.Color.White
        Me.AgLegend1.CaptionBackStyle = agLegendNET.agLegend.AGLegendCaptionBackStyle.agTransparent
        Me.AgLegend1.CaptionFont = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.AgLegend1.CaptionForeColor = System.Drawing.Color.Black
        Me.AgLegend1.CaptionText = "adsadsd"
        Me.AgLegend1.FixedWidth = -1
        Me.AgLegend1.ModalState = agLegendNET.agLegend.AGLegendModalStateConstants.agShowModal
        Me.AgLegend1.Moveable = True
        Me.AgLegend1.Shadowed = False
        Me.AgLegend1.ShapesStyle = agLegendNET.agLegend.AGLegendShapesStyleConstants.agShapedRectangle
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.LinkLabel1})
        Me.Name = "Form1"
        Me.Text = "Form1"

    End Sub

#End Region

    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
            With AgLegend1
                .CaptionForeColor = Color.White
                .CaptionBackColor = Color.DarkBlue
                .CaptionBackStyle = agOpaque
                .CaptionText = "United Colors of agLegend"
                .CaptionFont = New Font("Courier new", 8, FontStyle.Bold)
                .BackColor = Color.White
                .Moveable = True
                .ModalState = agShowModal
                .AddItem("First legend line", Color.Red)
                .AddItem("Second legend line", Color.ForestGreen, Color.DarkOrange)
                .AddItem("Third legend line", Color.RosyBrown)
                .AddItem("Long-long-long-long Long-long-long-long Long-long-long-long legend line", Color.Empty, New Font("Tahoma", 8, FontStyle.Bold Or FontStyle.Italic Or FontStyle.Underline), Color.Green)
                .AddItem("Next legend line", Color.DarkMagenta)
                .ShowLegend(LinkLabel1.Left, LinkLabel1.Top + LinkLabel1.Height, Me)
            End With
        Catch ex As Exception
        End Try
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LinkLabel1.Text = "This is only one of lot of variants for showing the legend. Click here to see the legend box. Try another combination of properties and enjoy."
        LinkLabel1.Links.Add(60, 10)

    End Sub
End Class

Project Homepage: