How to hide the caret in a RichTextBox?

后端 未结 9 1693
[愿得一人]
[愿得一人] 2020-12-31 15:10

Just like the title: I\'ve searched the web for an answer, but i was not able to find a way to hide the caret of a RichTextBox in VB.NET.

I\'ve tried to set the Rich

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-31 15:56

    /// 
    /// Transparent RichTextBox
    /// To change BackColor add a Panel control as holder of RichTextLabel
    /// 
    public class RichTextLabel : RichTextBox
    {
        public RichTextLabel()
        {
            base.Enabled = false;
            base.ReadOnly = true;
            base.ScrollBars = RichTextBoxScrollBars.None;
            base.ForeColor = Color.FromArgb(0, 0, 1);
        }
    
        override protected CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x20;
                return cp;
            }
        }
    
        override protected void OnPaintBackground(PaintEventArgs e)
        {
        }
    }
    

提交回复
热议问题