Eyeshot 11 Documentation
WinForms Control / Tutorials / Changing the entity default font
In This Topic
    Changing the entity default font
    In This Topic

    All entities implementing IText share the same default font.

    The "Default" style is applied to all text-derived entities that do not specify a different devDept.Eyeshot.Entities.Text.Style.

    There are two way to change it:

     

    Step 1 If you want change font to all text-derived entities you need to change Default Font to ViewportLayout.TextStyles Dictionary.

           The following code fragment shows how to change Default Font to Arial.

    viewportLayout1.TextStyles["Default"].FontFamilyName = "Arial";
    viewportLayout1.TextStyles("Default").FontFamilyName = "Arial"

     

    Step 2 If you want change font only to some text-derived entities the correct way to do is adding a new TextStyleData item to TextStyles Dictionary and specify the new item to Style property of Text entity.

    The following code fragment shows how to change the Font to Arial only to an entity.

    viewportLayout1.TextStyles.Add("Arial", new TextStyleData("Arial", FontStyle.Regular));
    
    devDept.Eyeshot.Entities.Text example = new devDept.Eyeshot.Entities.Text(c.StartPoint, "Camption Text.", 8);
    example.Style = "Arial";
    
    viewportLayout1.Entities.Add(example, Color.Red);
    viewportLayout1.TextStyles.Add("Arial", New TextStyleData("Arial", FontStyle.Regular))
    
    Dim example As New devDept.Eyeshot.Entities.Text(c.StartPoint, "Camption Text.", 8)
    example.Style = "Arial"
    
    viewportLayout1.Entities.Add(example, Color.Red)
    See Also