trichview.support
Re: textstyles |
Author |
Message |
George |
Posted: 03/11/2004 23:24:15 Sergey...thank you so much for your reply. It is just what I needed. One more thing though....how to make the StyleEx:=[fsAllcaps] work. Sorry if this is stupid. Thanks again. George "Sergey Tkachenko" <[email protected]> wrote: >Adding new text style: > >with RVStyle1.TextStyles.Add do >begin > FontName := 'Arial'; > Size := 10; >end; > >Applying it: > >Editor.RichViewEdit1.ApplyTextStyle(RVStyle1.TextStyles.Count-1); > >This was a simplified example. >If you will add styles any time, you'll have many identical styles in the >collections. >So we should search if the desired style already exists and reuse it if >possible. >There are several Find*** methods of RVStyle.TextStyles. >The most universal is FindSuchStyle. > >var fi: TFontInfo; > idx: Integer; > >fi := TFontInfo.Create(nil); >fi.FontName := 'Arial'; >fi.Size := 10; >idx := RVStyle1.TextStyles.FindSuchStyle(0, fi, RVAllFontInfoProperties); >if idx<0 then // not found >begin > RVStyle1.TextStyles.Add; > idx := RVStyle1.TextStyles.Count-1; > RVStyle1.TextStyles.Assign(fi); > RVStyle1.Standard := False; >end; > >Editor.RichViewEdit1.ApplyTextStyle(idx); > >Assigning Standard property to false allows DeleteUnusedStyles to delete >this style if it is not used in document any more. > >See the demo >Demos\Delphi\Editors\Editor 2\ > >Or you can use RichViewActions which will do this work for you: >http://www.trichview.com/resources/actions/ > > > >> >> Hello...I am new to this so be kind. >> >> Is there a way to create a textstyle in code? So if I have a font name in >> a combobox and a size in another it would equal a certian textstyle to be >> used in >> Editor.RichViewEdit1.ApplyTextStyle(?); >> >> Thanks for putting up with a rookie > > |
Powered by ABC Amber Outlook Express Converter