Beispiel #1
0
        public static void FileMsgAdd(string fileMsg, string path, RichTextBox box)
        {
            var    filemsg   = TextToRtf(fileMsg);
            var    path1     = TextToRtf(path);
            string insertRtf = @"{\rtf1" + TextToRtf(fileMsg) + @"\v #" + TextToRtf(path) + @"\v0}";
            int    iniPos    = box.SelectionStart;

            box.SelectedRtf     = insertRtf;
            box.SelectionStart  = iniPos;
            box.SelectionLength = insertRtf.Length;// filemsg.Length + path1.Length;//fileMsg.Length + path.Length;//filemsg.Length + path1.Length;//

            CHARFORMAT2A vCharFormat2a = new CHARFORMAT2A();

            vCharFormat2a.cbSize    = Marshal.SizeOf(typeof(CHARFORMAT2A));
            vCharFormat2a.dwMask    = CFM_LINK;
            vCharFormat2a.dwEffects = CFE_LINK;
            SendMessage(box.Handle, EM_SETCHARFORMAT, SCF_SELECTION,
                        vCharFormat2a);
        }
Beispiel #2
0
 public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam,
                                         [In, Out, MarshalAs(UnmanagedType.LPStruct)]   CHARFORMAT2A lParam);