Fame95's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
9 (0.01 per day)
Joined:
22-July 12
Profile Views:
134
Last Active:
User is offline Dec 19 2013 04:57 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Fame95 has not set their status

Posts I've Made

  1. In Topic: Richtextbox changes SelectionColor automatically

    Posted 7 Jan 2013

    View PostSkydiver, on 06 January 2013 - 04:30 PM, said:

    Check out this code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace WinFormsTest
    {
        public partial class Form1 : Form
        {
            RichTextBox _richTextBox = new RichTextBox();
            StatusBar _statusBar = new StatusBar();
    
            public Form1()
            {
                _statusBar.Dock = DockStyle.Bottom;
                _statusBar.Panels.Add("Hi");
    
                _richTextBox.Dock = DockStyle.Fill;
                _richTextBox.Selectionchanged += _richTextBox_Selectionchanged;
    
                Controls.Add(_statusBar);
                Controls.Add(_richTextBox);
    
                _richTextBox.Text = "int int int";
                _richTextBox.SelectAll();
                _richTextBox.SelectionColor = Color.Blue;
    
                // Mark the initial "int" and space as red.
                _richTextBox.Selectionstart = 0;
                _richTextBox.SelectionLength = 4;
                _richTextBox.SelectionColor = Color.Red;
            }
    
            void _richTextBox_Selectionchanged(object sender, EventArgs e)
            {
                _statusBar.Text = string.Format("{0}:{1}:{2}", _richTextBox.Selectionstart,
                                                               _richTextBox.SelectionLength,
                                                               _richTextBox.SelectionColor.ToString());
            }
        }
    }
    
    


    Notice that the status bar initially shows blue for the selection (pos 0, len 4), but if you manually select pos 0, len 4, it shows red.


    Thank you! I found that selecting the space after the word resolves my problem.
    Many thanks and sorry for the taken time to all of you ! :D

    View PostSkydiver, on 06 January 2013 - 04:30 PM, said:

    Check out this code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace WinFormsTest
    {
        public partial class Form1 : Form
        {
            RichTextBox _richTextBox = new RichTextBox();
            StatusBar _statusBar = new StatusBar();
    
            public Form1()
            {
                _statusBar.Dock = DockStyle.Bottom;
                _statusBar.Panels.Add("Hi");
    
                _richTextBox.Dock = DockStyle.Fill;
                _richTextBox.Selectionchanged += _richTextBox_Selectionchanged;
    
                Controls.Add(_statusBar);
                Controls.Add(_richTextBox);
    
                _richTextBox.Text = "int int int";
                _richTextBox.SelectAll();
                _richTextBox.SelectionColor = Color.Blue;
    
                // Mark the initial "int" and space as red.
                _richTextBox.Selectionstart = 0;
                _richTextBox.SelectionLength = 4;
                _richTextBox.SelectionColor = Color.Red;
            }
    
            void _richTextBox_Selectionchanged(object sender, EventArgs e)
            {
                _statusBar.Text = string.Format("{0}:{1}:{2}", _richTextBox.Selectionstart,
                                                               _richTextBox.SelectionLength,
                                                               _richTextBox.SelectionColor.ToString());
            }
        }
    }
    
    


    Notice that the status bar initially shows blue for the selection (pos 0, len 4), but if you manually select pos 0, len 4, it shows red.


    Thank you! I found that selecting the space after the word resolves my problem.
    Many thanks and sorry for the taken time to all of you ! :D
  2. In Topic: Richtextbox changes SelectionColor automatically

    Posted 7 Jan 2013

    View PostSkydiver, on 06 January 2013 - 04:30 PM, said:

    Check out this code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace WinFormsTest
    {
        public partial class Form1 : Form
        {
            RichTextBox _richTextBox = new RichTextBox();
            StatusBar _statusBar = new StatusBar();
    
            public Form1()
            {
                _statusBar.Dock = DockStyle.Bottom;
                _statusBar.Panels.Add("Hi");
    
                _richTextBox.Dock = DockStyle.Fill;
                _richTextBox.Selectionchanged += _richTextBox_Selectionchanged;
    
                Controls.Add(_statusBar);
                Controls.Add(_richTextBox);
    
                _richTextBox.Text = "int int int";
                _richTextBox.SelectAll();
                _richTextBox.SelectionColor = Color.Blue;
    
                // Mark the initial "int" and space as red.
                _richTextBox.Selectionstart = 0;
                _richTextBox.SelectionLength = 4;
                _richTextBox.SelectionColor = Color.Red;
            }
    
            void _richTextBox_Selectionchanged(object sender, EventArgs e)
            {
                _statusBar.Text = string.Format("{0}:{1}:{2}", _richTextBox.Selectionstart,
                                                               _richTextBox.SelectionLength,
                                                               _richTextBox.SelectionColor.ToString());
            }
        }
    }
    
    


    Notice that the status bar initially shows blue for the selection (pos 0, len 4), but if you manually select pos 0, len 4, it shows red.


    Thank you! I found that selecting the space after the word resolves my problem.
    Many thanks and sorry for the taken time to all of you ! :D
  3. In Topic: Richtextbox changes SelectionColor automatically

    Posted 7 Jan 2013

    View PostSkydiver, on 06 January 2013 - 04:30 PM, said:

    Check out this code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace WinFormsTest
    {
        public partial class Form1 : Form
        {
            RichTextBox _richTextBox = new RichTextBox();
            StatusBar _statusBar = new StatusBar();
    
            public Form1()
            {
                _statusBar.Dock = DockStyle.Bottom;
                _statusBar.Panels.Add("Hi");
    
                _richTextBox.Dock = DockStyle.Fill;
                _richTextBox.Selectionchanged += _richTextBox_Selectionchanged;
    
                Controls.Add(_statusBar);
                Controls.Add(_richTextBox);
    
                _richTextBox.Text = "int int int";
                _richTextBox.SelectAll();
                _richTextBox.SelectionColor = Color.Blue;
    
                // Mark the initial "int" and space as red.
                _richTextBox.Selectionstart = 0;
                _richTextBox.SelectionLength = 4;
                _richTextBox.SelectionColor = Color.Red;
            }
    
            void _richTextBox_Selectionchanged(object sender, EventArgs e)
            {
                _statusBar.Text = string.Format("{0}:{1}:{2}", _richTextBox.Selectionstart,
                                                               _richTextBox.SelectionLength,
                                                               _richTextBox.SelectionColor.ToString());
            }
        }
    }
    
    


    Notice that the status bar initially shows blue for the selection (pos 0, len 4), but if you manually select pos 0, len 4, it shows red.


    Thank you! I found that selecting the space after the word resolves my problem.
    Many thanks and sorry for the taken time to all of you ! :D
  4. In Topic: Richtextbox changes SelectionColor automatically

    Posted 6 Jan 2013

    View PosttlhIn`toq, on 06 January 2013 - 02:40 PM, said:

    I suspect you're trying to make a syntax highlighter.
    This should help:
    http://www.codeproje...ax-highlighting

    Plus it gives you well written source code to dissect for learning purposes.


    It is quite a syntax highlighter, but the link is useful. Thank you !

    View PostFame95, on 06 January 2013 - 02:42 PM, said:

    View PosttlhIn`toq, on 06 January 2013 - 02:40 PM, said:

    I suspect you're trying to make a syntax highlighter.
    This should help:
    http://www.codeproje...ax-highlighting

    Plus it gives you well written source code to dissect for learning purposes.


    It is quite a syntax highlighter, but the link is useful. Thank you !

    Mistake:
    It is not quite a syntax highlighter, but the link is useful. Thank you !
  5. In Topic: Richtextbox changes SelectionColor automatically

    Posted 6 Jan 2013

    View PosttlhIn`toq, on 06 January 2013 - 02:30 PM, said:

    The values in your code just don't make sense though.
    Look at lines 25 and 26. You start selection at 4 for a length of 0? What do you think that's going to select?

    Honestly I have my doubts about what is really happening and if this is really the code producing your supposed results.
    Using your code all I get is a row of red text which makes sense since that is the only text you ever select.

    I'd like to see some screen shots of the actual behavior and a screen shot of the code doing it.


    Line 25 deselects the text selected in lines 22 and 23. Line 26 just puts the caret just before the second word.There is only one selection made (from 0 to 7).

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Fame95 hasn't added any friends yet.

Comments

Fame95 has no profile comments yet. Why not say hello?