Apply(Value: ITabFont);
Value is the font parameters of which are to be applied to the current font.
The Apply method sets parameters of the current font in accordance with parameters of the font passed by the Value parameter.
When the method is called, only the parameters specified for the original font passed by the Value parameter are to be set for the current font. Original font parameters with undefined values are not redefined for the current font.
Sub UserProc;
Var
Style1, Style2, Style3, Style4: ITabCellStyle;
Font2, Font4: ITabFont;
Begin
Style1 := New TabCellStyle.Create;
Style2 := New TabCellStyle.Create;
Style3 := New TabCellStyle.Create;
Style4 := New TabCellStyle.Create;
//Determines font parameters
Style1.Font.Bold := TriState.OnOption;
Style2.Font.Italic := TriState.OnOption;
//Parameters of font of the second style
Style3.Font.Bold := TriState.OnOption;
Style4.Font.Italic := TriState.OnOption;
//Applying font styles
Font2 := Style2.Font;
Font4 := Style4.Font;
Font2.Apply(Style1.Font);
Font4.Assign(Style3.Font);
//Checking adjusted parameters
Debug.WriteLine(Font2.Bold);
Debug.WriteLine(Font2.Italic);
Debug.WriteLine(Font4.Bold);
Debug.WriteLine(Font4.Italic);
End Sub UserProc;
When this example is executed four styles are created. One of the font parameters is enabled. Parameters of the Style1 font are applied to Style2, and Style3 parameters are applied to Style4. When the Apply method is used, as the Italic parameter specified in Style2 it is not reset when Style1 is apllied. When the Assign method is used, as the Italic parameter is undefined in Style3, the value of this parameter is to be reset in Style4.
After executing this example console of development environment displays the following results of checking properties' values:
-1
-1
-1
-2
See also: