Esempio n. 1
0
        public static IntPtr DontDrawRichEditControl(System.Windows.Forms.RichTextBox c)
        {
            IntPtr eventMask = IntPtr.Zero;

            try
            {
                // Stop redrawing:
                RTF.SendMessage_generic(c.Handle, WM_SETREDRAW, IntPtr.Zero, IntPtr.Zero);
                // Stop sending of events:
                eventMask = RTF.SendMessage_generic(c.Handle, EM_GETEVENTMASK, IntPtr.Zero, IntPtr.Zero);

                // change colors and stuff in the RichTextBox
            }
            catch
            {
                try
                {
                    // turn on events
                    RTF.SendMessage_generic(c.Handle, EM_SETEVENTMASK, IntPtr.Zero, eventMask);
                    // turn on redrawing
                    RTF.SendMessage_generic(c.Handle, WM_SETREDRAW, (IntPtr)1, IntPtr.Zero);
                }
                catch { }
            }

            return(eventMask);
        }
Esempio n. 2
0
        public static void DrawRichEditControl(System.Windows.Forms.RichTextBox c, IntPtr eventMask)
        {
            try
            {
                // turn on events
                //RTF.SendMessage_generic(c.Handle, EM_SETEVENTMASK, IntPtr.Zero, eventMask);

                // turn on redrawing
                RTF.SendMessage_generic(c.Handle, WM_SETREDRAW, (IntPtr)1, IntPtr.Zero);

                // perform the actual redraw
                //RTF.InvalidateRect(c.Handle, IntPtr.Zero, FALSE);
                // invalidation is done with Control.Refresh() now
            }
            catch { }
        }