Esempio n. 1
0
        private void OutputRtf(RichTextBoxEx rtb, string s)
        {
            s = s.Trim();

            if (string.IsNullOrEmpty(s) == false)
            {
                Rtf myRtf = new Rtf(_Fonts,
                    _GridPanel.SuperGrid.FilterExprColors.Colors);

                myRtf.BeginGroup(true);

                myRtf.Font = 0;
                myRtf.FontSize = _FontSize;
                myRtf.ForeColor = (int)ExprColorPart.Default;

                Regex r = new Regex("(#@@#\\d)");
                MatchCollection mc = r.Matches(s);

                if (mc.Count > 0)
                {
                    int index = 0;

                    for (int i = 0; i < mc.Count; i++)
                    {
                        Match ma = mc[i];

                        if (ma.Index > index)
                            myRtf.WriteText(s.Substring(index, ma.Index - index));

                        index = ma.Index + ma.Length;

                        myRtf.ForeColor = s[index - 1] - '0';
                    }

                    if (s.Length > index)
                        myRtf.WriteText(s.Substring(index, s.Length - index));
                }
                else
                {
                    myRtf.WriteText(s);
                }

                myRtf.EndGroup();
                myRtf.Close();

                rtb.Rtf = myRtf.RtfText;
            }
            else
            {
                rtb.Text = "";
            }
        }
Esempio n. 2
0
        private void OutputRtfError(
            RichTextBoxEx rtbOut, string text, string error)
        {
            Rtf myRtf = new Rtf(_Fonts,
                _GridPanel.SuperGrid.FilterExprColors.Colors);

            myRtf.BeginGroup(true);

            myRtf.Font = 0;
            myRtf.FontSize = _FontSize;
            myRtf.ForeColor = (int)ExprColorPart.Default;

            myRtf.WriteText(text);
            myRtf.WriteText("  ");

            myRtf.ForeColor = (int)ExprColorPart.Error;

            myRtf.WriteLine();
            myRtf.WriteLine();
            myRtf.WriteText("(" + error + ")");

            myRtf.EndGroup();
            myRtf.Close();

            rtbOut.Rtf = myRtf.RtfText;
        }
Esempio n. 3
0
        private void OutPutWaterMarkText(RichTextBoxEx rtbOut)
        {
            if (_GridPanel != null &&
                string.IsNullOrEmpty(_WaterMarkText) == false)
            {
                Rtf myRtf = new Rtf(_Fonts,
                    _GridPanel.SuperGrid.FilterExprColors.Colors);

                myRtf.BeginGroup(true);

                myRtf.Font = 0;
                myRtf.FontSize = _FontSize;
                myRtf.CenterAlignText();

                myRtf.ForeColor = (int)ExprColorPart.Dim;

                myRtf.WriteLine();
                myRtf.WriteText(_WaterMarkText);

                myRtf.EndGroup();
                myRtf.Close();

                rtbOut.Rtf = myRtf.RtfText;
            }
            else
            {
                rtbOut.Clear();
            }
        }