Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

RichTextBox control formatting issue

$
0
0

I have an extended RichTextBox control which is working properly in Windows 7. It is loosing formatting if I run the same on Windows 8. Please find the images I had for Windows 7 and Windows 8.

Windows 8 image

RTF is rendering peroperly on Windows 7, as you can see the bullets

Windows 7

Extendedd RichTextbox  class class

 public class CustomRichTextBox : RichTextBox
    {
        public CustomRichTextBox()
        {
        }
        [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
        private static extern IntPtr LoadLibrary(string lpFileName);

        private IntPtr mHandle = IntPtr.Zero;
     
        protected override CreateParams CreateParams
        {
            get
            {
                //Prevent module being loaded multiple times.
                if (this.mHandle == IntPtr.Zero)
                {
                    //load the library to obtain an instance of the RichEdit50 class.
                    this.mHandle = LoadLibrary("msftedit.dll");
                }
                CreateParams cParams = base.CreateParams;
                //If module loaded, reset ClassName.
                if (this.mHandle != IntPtr.Zero)
                {
                    // Check Unicode or ANSI system and set appropriate ClassName.
                    if (Marshal.SystemDefaultCharSize == 1)
                    {
                        cParams.ClassName = "RichEdit50A"; //These are 4.1 (MSFTEDIT_CLASS)
                    }
                    else
                    {
                        cParams.ClassName = "RichEdit50W";
                    }
                }
                return cParams;
            }
        }
	}

Can anyone please suggest, how can I fix this?.  Thanks in advance.


--Krishna


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>