Nevron Forum

Incomplite example TextShape ?

https://www.nevron.com/Forum/Topic2575.aspx

By michal bandrowski - Thursday, August 20, 2009

Hi,

In Menu Start - nevron vision 2009.1 - nevron ui - winform - exmaple - DOM - shapes - textshape ...
there is no body for methods ?

CreateWrappedText();
CreateStretchedText();
CreateWrappedTextWithBackplane();
CreateStretchedTextWithBackplane();
CreateXMLFormattedText();

Could you please post them here ?

regards,
Michal

By Pavel Vladov - Wednesday, September 2, 2009

private void CreateWrappedText()

{

    // create text

    NTextShape text = new NTextShape("Wrapped text with font: Tahoma and size: 8", base.GetGridCell(0, 0));

    text.Style.TextStyle = new NTextStyle(new Font("Tahoma", 8), base.GetPredefinedColor(0));

    text.Mode = BoxTextMode.Wrap;

   

    // add to active layer

    document.ActiveLayer.AddChild(text);

    document.SmartRefreshAllViews();

}

 

private void CreateStretchedText()

{

    // create text

    NTextShape text = new NTextShape("Stretched text", base.GetGridCell(0, 1));

    text.Style.TextStyle = new NTextStyle(new Font("Tahoma", 8), base.GetPredefinedColor(1));

    text.Mode = BoxTextMode.Stretch;

   

    // add to active layer

    document.ActiveLayer.AddChild(text);

    document.SmartRefreshAllViews();

}

 

private void CreateWrappedTextWithBackplane()

{

    // create text

    NTextShape text = new NTextShape("Wrapped text with backplane", base.GetGridCell(1, 0));

    text.Style.TextStyle = new NTextStyle(new Font("Arial", 10), base.GetPredefinedColor(2));

    text.Style.TextStyle.BackplaneStyle.Visible = true;

    text.Style.TextStyle.BackplaneStyle.Shape = BackplaneShape.Ellipse;

    text.Mode = BoxTextMode.Wrap;

   

    // add to active layer

    document.ActiveLayer.AddChild(text);

    document.SmartRefreshAllViews();

}

 

private void CreateStretchedTextWithBackplane()

{

    // create text

    NTextShape text = new NTextShape("Stretched text with backplane", base.GetGridCell(1, 1));

    text.Style.TextStyle = new NTextStyle(new Font("Arial", 10), base.GetPredefinedColor(3));

    text.Style.TextStyle.BackplaneStyle.Visible = true;

    text.Style.TextStyle.BackplaneStyle.Shape = BackplaneShape.SmoothEdgeRectangle;

    text.Mode = BoxTextMode.Stretch;

   

    // add to active layer

    document.ActiveLayer.AddChild(text);

    document.SmartRefreshAllViews();

}

 

private void CreateXMLFormattedText()

{

    NRectangleF cell = base.GetGridCell(2, 0, 1, 1);

   

    // create text

    NTextShape text = new NTextShape(

        "<b>XML</b> Formatted Text allows you to <br></br>" +

        "<font face = 'Tahoma' size = '19'>mix</font> <font face = 'Impact' size = '22'>fonts</font> <br></br>" +

        "<font gradient = '0, 0, white, red'>display text with gradiens</font> <br></br>" +

        "<font size = '22' border = '1' bordercolor = 'gray'>display text with borders</font> <br></br>" +

        "<font shadowoffset = '2, 2' shadowfadelength = '3' shadowtype = 'gaussianblur'>display text with shadows</font> <br></br>" +

        "display text with <b>bold</b>, <i>italic</i>, <u>underline</u> and <strike>strikeout</strike>",

        cell);

   

    text.Style.TextStyle = new NTextStyle(new Font("Arial", 12), base.GetPredefinedColor(4));

    text.Style.TextStyle.TextFormat = TextFormat.XML;

   

    // add to active layer

    document.ActiveLayer.AddChild(text);

    document.SmartRefreshAllViews();

}