c# performance- create font

Posted by user85917 on Stack Overflow See other posts from Stack Overflow or by user85917
Published on 2010-05-04T21:57:47Z Indexed on 2010/05/04 22:08 UTC
Read the original article Hit count: 118

Filed under:
|
|

I have performance issues in this code segment which I think is caused by the "new Font".

Will it be faster if fonts are static/global ?

if (row.StartsWith(TILD_BEGIN))  
{
    rtbTrace.SelectionColor = Color.Maroon; 
    rtbTrace.SelectionFont = new Font(myFont, (float)8.25, FontStyle.Regular);

    if (row.StartsWith(BEGIN) ) 
        rtbTrace.AppendText(Environment.NewLine + row + Environment.NewLine);
    else
        rtbTrace.AppendText(Environment.NewLine + row.Substring(1) 
            + Environment.NewLine);

    continue;
}

if (row.StartsWith(EXCL_BEGIN))
{
    -- similar block
}

if (row.StartsWith(DLR_BEGIN))
{
    -- similar block
}
.
.
.

© Stack Overflow or respective owner

Related posts about c#

Related posts about fonts