当前位置: 首页>>代码示例>>C#>>正文


C# RichTextBox.SetCharFormat方法代码示例

本文整理汇总了C#中System.Windows.Forms.RichTextBox.SetCharFormat方法的典型用法代码示例。如果您正苦于以下问题:C# RichTextBox.SetCharFormat方法的具体用法?C# RichTextBox.SetCharFormat怎么用?C# RichTextBox.SetCharFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.RichTextBox的用法示例。


在下文中一共展示了RichTextBox.SetCharFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: applyLinkStyle

 private static void applyLinkStyle(RichTextBox rtb, List<KeyValuePair<int, int>> links)
 {
     // apply links style
     CHARFORMAT ncf = new CHARFORMAT(CFM.LINK, CFE.LINK);
     foreach (var pair in links)
     {
         rtb.Select(pair.Key, pair.Value);
         rtb.SetCharFormat(ncf);
     }
 }
开发者ID:nitoyon,项目名称:gitextensions,代码行数:10,代码来源:XHTML2RTF.cs

示例2: HandleTextAndWhitespace

        private static PARAFORMAT HandleTextAndWhitespace(RichTextBox rtb, PARAFORMAT pf, CHARFORMAT cf, string strData)
        {
            bool bNewParagraph = (strData.IndexOf("\r\n", 0) >= 0) || (strData.IndexOf("\n", 0) >= 0);

            if (strData.Length > 0)
            {
                // now, add text to control
                int nStartCache = rtb.SelectionStart;

                rtb.SelectedText = strData;

                rtb.Select(nStartCache, strData.Length);

                // apply format
                rtb.SetParaFormat(pf);
                rtb.SetCharFormat(cf);
            }

            // reposition to final
            rtb.Select(rtb.TextLength + 1, 0);

            // new paragraph requires to reset alignment
            if (bNewParagraph)
            {
                pf.dwMask = PFM.ALIGNMENT | PFM.NUMBERING;
                pf.wAlignment = PFA.LEFT;
                pf.wNumbering = 0;
            }
            return pf;
        }
开发者ID:nitoyon,项目名称:gitextensions,代码行数:30,代码来源:XHTML2RTF.cs

示例3: ProcessSignificantWhitespace

        private static bool ProcessSignificantWhitespace(RichTextBox rtb, ref CHARFORMAT cf, ref PARAFORMAT pf, string strData)
        {
            bool bNewParagraph = (strData.IndexOf("\r\n", 0) >= 0) || (strData.IndexOf("\n", 0) >= 0);

            if (strData.Length > 0)
            {
                // now, add text to control
                int nStartCache = rtb.SelectionStart;

                rtb.SelectedText = strData;

                rtb.Select(nStartCache, strData.Length);

                // apply format
                rtb.SetParaFormat(pf);
                rtb.SetCharFormat(cf);
            }

            // reposition to final
            rtb.Select(rtb.TextLength + 1, 0);
            return bNewParagraph;
        }
开发者ID:ImaginaryDevelopment,项目名称:gitextensions,代码行数:22,代码来源:XHTML2RTF.cs


注:本文中的System.Windows.Forms.RichTextBox.SetCharFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。