コード例 #1
0
        public static LinkLabel AddLink(this Control Control, string Text, Font Font, Point Location, Color LinkColor, LinkBehavior LinkBehavior)
        {
            LinkLabel Link = new LinkLabel();

            Link.Text         = Text;
            Link.AutoSize     = true;
            Link.Font         = Font;
            Link.LinkColor    = LinkColor;
            Link.BackColor    = Color.Transparent;
            Link.LinkBehavior = LinkBehavior;
            Control.Controls.Add(Link);
            if (Location.Y == -1000)
            {
                Link.Location = new Point(Location.X, Link.MidH());
            }
            else if (Location.X == -1000)
            {
                Link.Location = new Point(Link.MidW(), Location.Y);
            }
            else
            {
                Link.Location = Location;
            }
            Link.Refresh();

            return(Link);
        }