richTextBox selectedText WinForms

Page 1 of 1

1 Replies - 225 Views - Last Post: 30 December 2012 - 02:17 PM Rate Topic: -----

#1 charqus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 07-February 10

richTextBox selectedText WinForms

Posted 30 December 2012 - 02:09 PM

Hello guys. I have a simple Windows Form Application, and I docked on my form an richTextBox. I have set the next lines:
        public Form1()
        {
            InitializeComponent();
            this.Load += new EventHandler(Form1_Load);
        }

        void Form1_Load(object sender, EventArgs e)
        {
            richTextBox1.Text = "This\nis\nmy\nlittle\ntest!";
            richTextBox1.ReadOnly = true;
            richTextBox1.ZoomFactor = 3.0f;
            richTextBox1.SelectAll();
            richTextBox1.SelectionAlignment = HorizontalAlignment.Center;
        }

And when I debug the program, with my mouse I can select the text from my richTextBox, and that cursor for typing appears on my richTextBox ( please check the screenshots ):
cursor: http://img132.images...06/75852424.png
cursor: http://img28.imagesh...09/43502289.png
selected text with mouse: http://img715.images...18/28203295.png

Actually, I tried with richTextBox.Enabled = false, but this property change my background color and my foreground color of my richTextBox...

Is This A Good Question/Topic? 0
  • +

Replies To: richTextBox selectedText WinForms

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3449
  • View blog
  • Posts: 10,643
  • Joined: 05-May 12

Re: richTextBox selectedText WinForms

Posted 30 December 2012 - 02:17 PM

Closing duplicate...

Closing dupe...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1