Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 有没有办法更改文档中一批文本的字体大小_C#_Txtextcontrol - Fatal编程技术网

C# 有没有办法更改文档中一批文本的字体大小

C# 有没有办法更改文档中一批文本的字体大小,c#,txtextcontrol,C#,Txtextcontrol,我有一堆文本需要更改字体大小。我想要的文本块位于文档的中间。 所以现在,我所做的是下面。我一直收到一些不改变字体大小的文本。有更好的方法吗?我试着逐字逐句地讲,但这显然需要很长时间才能完成。还尝试通过txcontrollobj.find方法查找全文时,会出现内存不足的错误 // processedText is the block that needs to have the changed font size while (processedText != Stri

我有一堆文本需要更改字体大小。我想要的文本块位于文档的中间。 所以现在,我所做的是下面。我一直收到一些不改变字体大小的文本。有更好的方法吗?我试着逐字逐句地讲,但这显然需要很长时间才能完成。还尝试通过
txcontrollobj.find
方法查找全文时,会出现内存不足的错误

       // processedText is the block that needs to have the changed font size
       while (processedText != String.Empty)
        {
            if (processedText.Length > 50)
                processRange = 50;
            else
                processRange = processedText.Length;

            startPos = TxControlObj.Find(processedText.Substring(0, processRange), startPos, TXTextControl.FindOptions.NoMessageBox);
            TxControlObj.Selection.FontSize = fontSize;
            processedText = processedText.Remove(0, processRange);
        }
        //This last bit here is because, I get highlighted text at the end of the loop otherwise.
        startPos = TxControlObj.Find("", startPos, TXTextControl.FindOptions.NoMessageBox); 
        TxControl.Update();