/// <summary> /// Copy information from TextBox to LinkLabel. /// </summary> private void FillLinkData() { // Copy the text FLinkLabel.Text = this.Text; // Figure out if we need mailto: or http:// link string LinkType = ""; switch (FLinkType) { case THyperLinkHandling.THyperLinkType.Http: if ((this.Text.ToLower().IndexOf(@"http://") < 0) && (this.Text.ToLower().IndexOf(@"https://") < 0)) { LinkType = @"http://"; } break; case THyperLinkHandling.THyperLinkType.Ftp: if (this.Text.ToLower().IndexOf(@"ftp://") < 0) { LinkType = @"ftp://"; } break; case THyperLinkHandling.THyperLinkType.Email: if (this.Text.ToLower().IndexOf("mailto:") < 0) { LinkType = "mailto:"; } break; case THyperLinkHandling.THyperLinkType.Skype: if (this.Text.ToLower().IndexOf("skype:") < 0) { LinkType = "skype:"; } break; } // Clear old links and create a new one FLinkLabel.Links.Clear(); FLinkLabel.Links.Add(0, FLinkLabel.Text.Length, LinkType + this.Text); }
/// <summary> /// Copy information from TextBox to LinkLabel. /// </summary> private void FillLinkData() { // Copy the text FLinkLabel.Text = this.Text; // Figure out if we need mailto: or http:// link string LinkType = ""; switch (FLinkType) { case THyperLinkHandling.THyperLinkType.Http: if ((this.Text.ToLower().IndexOf(@"http://") < 0) && (this.Text.ToLower().IndexOf(@"https://") < 0)) { LinkType = @"http://"; } break; case THyperLinkHandling.THyperLinkType.Ftp: if (this.Text.ToLower().IndexOf(@"ftp://") < 0) { LinkType = @"ftp://"; } break; case THyperLinkHandling.THyperLinkType.Email: if (this.Text.ToLower().IndexOf("mailto:") < 0) { LinkType = "mailto:"; } break; case THyperLinkHandling.THyperLinkType.Skype: if (this.Text.ToLower().IndexOf("skype:") < 0) { LinkType = "skype:"; } break; } // Clear old links and create a new one FLinkLabel.Links.Clear(); FLinkLabel.Links.Add(0, FLinkLabel.Text.Length, LinkType + this.Text); }