IWPAttrInterface CurrAttr

[Top]  [Chapter]  [Previous]  [Next]

This interface allows the modification of the current writing mode. It changes the current writing mode. If you need to change the selected text or, if no text is selected, the current writing mode - this is what tool bar buttons usually do - use property TextAttr.

 

The interface IWPAttrInterface has several methods to read and write properties, i.e. AttrGet and AttrSet. These methods expect the property ID (WPAT...) - the manual (PDF) contains a list of the available WPAT codes. If the AttrGet function returns the value false, the value has not been defined. This means the inherited or the default value will be used for this property.

 

This C# example code creates text to show the possible underline modes.

 string[] cnames = new string[]

 { "WPUND_Standard"

 , "WPUND_Dotted"

 , "WPUND_Dashed"

 , "WPUND_Dashdotted"

 , "WPUND_Dashdotdotted"

 , "WPUND_Double"

 , "WPUND_Heavywave"

 , "WPUND_Longdashed"

 , "WPUND_Thick"

 , "WPUND_Thickdotted"

 , "WPUND_Thickdashed"

 , "WPUND_Thickdashdotted"

 , "WPUND_Thickdashdotdotted"

 , "WPUND_Thicklongdashed"

 , "WPUND_Doublewave"

 , "WPUND_WordUnderline"

 , "WPUND_wave"

 , "WPUND_curlyunderline" };

 

 IWPMemo Memo = WPDLLInt1.Memo;

 IWPAttrInterface CurrAttr = Memo.CurrAttr;

 IWPTextCursor TextCursor = Memo.TextCursor;

 

 Memo.Clear(false,false);

 CurrAttr.Clear();

 CurrAttr.SetFontface("Verdana");

 //150% Line Height

 CurrAttr.AttrSET((int)WPAT.LineHeight, 150);

 

 int m = 1;

 foreach (string s in cnames)

 {

         TextCursor.InputParagraph(0, "");

         CurrAttr.SetUnderlineMode(m);

         CurrAttr.SetUnderlineColor(

                         WPDLLInt1.ToRGB(Color.Red));

         TextCursor.InputText(m.ToString());

         TextCursor.InputText(" = ");

         TextCursor.InputText(s);

         m++;

 }

 Memo.Reformat();

 

 


[iwpattrinterfacecurrattr2.htm]    Copyright © 2007 by WPCubed GmbH