Jump to content

Word Wrap problem In c#

- - - - -

  • Please log in to reply
5 replies to this topic

#1
shyamenk

shyamenk

    Newbie

  • Members
  • PipPip
  • 11 posts
Plz send the working code of word wrap in notepad,the present situation is enabled the word wrap option but not working properly
im using this code listed below.........



CODE:::::::::::::::

private void wordWrapToolStripMenuItem_Click(object sender, EventArgs e)
{


if (wordWrapToolStripMenuItem.Checked == false)
{

wordWrapToolStripMenuItem.Checked = true;

richTextBox1.WordWrap = true;

}

else
{

wordWrapToolStripMenuItem.Checked = false;

richTextBox1.WordWrap = false;

}
}

#2
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
You need to make sure your richTextBox property "CheckOnClick" is set to true, that way the wordwrap can turn off.
This code will work fine:
if (wordWrapToolStripMenuItem.Checked == true)
            {
                richTextBox1.WordWrap = true;
            }
            else { richTextBox1.WordWrap = false; }

A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.

#3
sam_coder

sam_coder

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 372 posts
not sure what it is your trying to do, but you're doing it long hand.. =)

private void wordWrapToolStripMenuItem_Click(object sender, EventArgs e)

{

    wordWrapToolStripMenuItem.Checked = !wordWrapToolStripMenuItem.Checked;

    richTextBox1.WordWrap = richTextBox1.WordWrap;

}


would be much cleaner...

#4
sam_coder

sam_coder

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 372 posts
that was in response to original post, not you committed =)

#5
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts

Quote

that was in response to original post, not you committed =)
Yeah I know. :)

Nice solution! Something I never would of thought of. ~ Committed. :)
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.

#6
sam_coder

sam_coder

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 372 posts
wait, hold on, I posted an obvious bug, wasnt paying attention...
private void wordWrapToolStripMenuItem_Click(object sender, EventArgs e)

{

    wordWrapToolStripMenuItem.Checked = !wordWrapToolStripMenuItem.Checked;

    richTextBox1.WordWrap = wordWrapToolStripMenuItem.Checked;

}

=)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users