CustomHyperlinkStyle: Boolean;
CustomHyperlinkStyle: Boolean;
The CustomHyperlinkStyle property determines the use of user hyperlink style.
The property is relevant if ITerm.IsHyperlink is set to True.
If the property is set to True, user settings of term are applied to hyperlink style, for example, color.
If the property is set to False, standard style is applied to the hyperlink.
Executing the example requires a form with two buttons named Button1 and Button2 and the TermEdit component named TermEdit1. Connect to the Drawing system assembly.
Terms: ITermList;
Term: ITerm;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
color1 : IGxColor;
color2 : IGxColor;
color3 : IGxColor;
Begin
Terms := TermEdit1.Terms;
Term := Terms.Item(0);
Term.Text := "Prognoz";
// Set up term as a hyperlink
Term.IsHyperlink := True;
// Use user-defined style of term hyperlink
Term.CustomHyperlinkStyle := True;
// Set underlining for the term
Term.Underlined := True;
// Create colors
color1 := New GxColor.CreateRGB( 170,40,200);
color2 := New GxColor.CreateRGB( 120,40,200);
color3 := New GxColor.CreateRGB( 70,40,200);
// Set colors for two characters of the term, starting with the first one
Term.SetTextColor(color1,0,2);
// Set colors for two characters of the term, starting with the third one
Term.SetTextColor(color2,2,2);
// Set colors for two characters of the term, starting with the fifth one
Term.SetTextColor(color3,4,2);
End Sub Button1OnClick;
Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Clr : IGxColor;
Begin
// Pass color of the first character to name of the button
Clr := Term.GetTextColor(0);
Button2.text := Clr.R.ToString + ", " + Clr.G.ToString + ", " + Clr.B.ToString;
// Reset color setting of the term
Term.ResetTextColor;
// Remove underlining
Term.Underlined := False;
End Sub Button2OnClick;
After executing the example clicking the first button displays the term as a hyperlink with the user-defined style: underlined with gradient color. Clicking the second button replaces text on the button with the color of the first character of the term in the RGB format, after that the term color is reset, and underlining is removed.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Forms;
Var
Terms: ITermList;
Term: ITerm;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
color1 : GxColor;
color2 : GxColor;
color3 : GxColor;
Begin
Terms := TermEditNet1.Terms;
Term := Terms.Item[0];
Term.Text := "Prognoz";
// Set up term as a hyperlink
Term.IsHyperlink := True;
// Use custom style for the term
Term.CustomHyperlinkStyle := True;
// Set underlining for the term
Term.Underlined := True;
// Create colors
color1 := New GxColorClass_2();
color2 := New GxColorClass_2();
color3 := New GxColorClass_2();
color1.CreateRGB( 170,40,200);
color2.CreateRGB( 120,40,200);
color3.CreateRGB( 70,40,200);
// Set colors for two characters of the term, starting with the first one
Term.SetTextColor(color1,0,2);
// Set colors for two characters of the term, starting with the third one
Term.SetTextColor(color2,2,2);
// Set colors for two characters of the term, starting with the fifth one
Term.SetTextColor(color3,4,2);
End Sub button1_Click;
Private Sub button2_Click(sender: System.Object; e: System.EventArgs);
Var
Clr : IGxColor;
Begin
// Pass color of the first character to name of the button
Clr := Term.GetTextColor(3);
Button2.text := Clr.R.ToString() + ", " + Clr.G.ToString() + ", " + Clr.B.ToString();
// Reset color setting of the term
Term.ResetTextColor();
//Remove underlining
Term.Underlined := False;
End Sub button2_Click;
See also: