private void legendToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Form legend = new Form();
                legend.Icon        = BIDSHelper.Resources.Common.BIDSHelper;
                legend.Text        = "Visualize Attribute Lattice - Legend";
                legend.MaximizeBox = false;
                legend.MinimizeBox = false;
                PictureBox pic = new PictureBox();
                pic.Location = new System.Drawing.Point(0, 0);
                pic.Size     = new System.Drawing.Size(290, 480);


                Bitmap   canvas = new Bitmap(pic.Width, pic.Height);
                Graphics g      = Graphics.FromImage(canvas);
                g.SmoothingMode = SmoothingMode.AntiAlias;
                g.FillRectangle(new SolidBrush(Color.White), 0, 0, canvas.Width, canvas.Height);

                g.DrawString("Relationship Types", new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold | FontStyle.Underline), new SolidBrush(Color.Black), new RectangleF(10, 12, 200, 25));
                Pen pen = new Pen(Color.Green, 1.55F); //Color.Gray) //active and rigid
                g.DrawLine(pen, 10, 50, 100, 50);      //active and rigid
                g.DrawString("= Active and rigid", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, 45 - 3, 200, 25));
                pen.DashStyle   = DashStyle.Dash;
                pen.DashPattern = new float[] { 1F, 1.55F };
                g.DrawLine(pen, 10, 75, 100, 75); //active and flexible
                g.DrawString("= Active and flexible", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, 70 - 3, 200, 25));
                pen = new Pen(Color.Gray, 1.55F);
                g.DrawLine(pen, 10, 100, 100, 100); //inactive and rigid
                g.DrawString("= Inactive and rigid", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, 95 - 3, 200, 25));
                pen.DashStyle   = DashStyle.Dash;
                pen.DashPattern = new float[] { 1F, 1.55F };
                g.DrawLine(pen, 10, 125, 100, 125); //inactive and flexible
                g.DrawString("= Inactive and flexible", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, 120 - 3, 200, 25));

                pen.Width       = 5;
                pen.Color       = Color.Red;
                pen.DashStyle   = DashStyle.Dash;
                pen.DashPattern = new float[] { 0.4F, 1.5F };
                g.DrawLine(pen, 10, 150, 100, 150); //overlapping relationship being highlighted so it is seen
                g.DrawString("= Red ensures overlapping\r\n   relationship is seen", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Italic), new SolidBrush(Color.Black), new RectangleF(105, 145 - 3, 200, 40));


                g.DrawString("Attribute Types", new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold | FontStyle.Underline), new SolidBrush(Color.Black), new RectangleF(10, 200, 200, 25));

                StringFormat centered = new StringFormat();
                centered.Alignment = StringAlignment.Center;

                RectangleF fillRect = new RectangleF(10, 230, 90, 40);
                g.FillRectangle(new SolidBrush(Color.LightBlue), fillRect);
                fillRect.Y += 12;
                g.DrawString("Attribute", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), fillRect, centered);
                g.DrawString("= Visible and enabled", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, fillRect.Y, 200, fillRect.Height));

                fillRect = new RectangleF(10, 285, 90, 40);
                g.FillRectangle(new SolidBrush(Color.LightBlue), fillRect);
                fillRect.Y += 12;
                g.DrawString("Attribute", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Italic), new SolidBrush(Color.Gray), fillRect, centered);
                g.DrawString("= Visible and disabled", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, fillRect.Y, 200, fillRect.Height));

                fillRect = new RectangleF(10, 340, 90, 40);
                g.FillRectangle(new SolidBrush(Color.LightGray), fillRect);
                fillRect.Y += 12;
                g.DrawString("Attribute", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), fillRect, centered);
                g.DrawString("= Invisible and enabled", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, fillRect.Y, 200, fillRect.Height));

                fillRect = new RectangleF(10, 395, 90, 40);
                g.FillRectangle(new SolidBrush(Color.LightGray), fillRect);
                fillRect.Y += 12;
                g.DrawString("Attribute", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Italic), new SolidBrush(Color.Gray), fillRect, centered);
                g.DrawString("= Invisible and disabled", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, fillRect.Y, 200, fillRect.Height));

                g.Dispose();
                pic.Image = canvas;
                legend.Controls.Add(pic);
                legend.Width         = canvas.Width;
                legend.Height        = canvas.Height;
                legend.MinimumSize   = legend.Size;
                legend.MaximumSize   = legend.Size;
                legend.SizeGripStyle = SizeGripStyle.Hide;
                pic.PerformLayout();
                this.PerformLayout();
                legend.ShowDialog();
                legend.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
        }