Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 2628354

@User 2628354
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Getting ToolStrip button's CheckState to reflect RichTextBox content
    U User 2628354

    Thanks Cassandra: I previously wasn't able to get the syntax to do what I needed to do. I just kept dancing around the issue in code, but couldn't quite get it right. That took care of it. Thanks for responding. Richard

    C# csharp tutorial question

  • Getting ToolStrip button's CheckState to reflect RichTextBox content
    U User 2628354

    Dear Sirs: I have a C# application with a ToolStrip control and a RichTextBox control. Three of the buttons are for aligning the text, i.e., Align Left, Center, Align Right. And two of the buttons are for increasing and decreasing Indentation. I have the CheckOnClick property set to true for these buttons. My application also has formatting buttons, i.e., Bold, Italic, Underlined and one button for setting a bulleted style. It was previously suggested that I use the RichTextBox_SelectionChanged event, which in fact works for the formatting buttons and Bullets button. However, I am running into a dead-end when attempting to write code for the alignment buttons or the 2-Indentation buttons. For example, when I try something like the following code:

    tsBtnAlignLeft.Checked = richTextBoxBody.SelectionAlignment;
    tsBtnAlignCtr.Checked = richTextBoxBody.SelectionAlignment;
    tsBtnAlignRight.Checked = richTextBoxBody.SelectionAlignment;

    it throws this exception: "Cannot implicitly convert type System.Windows.Forms.HorizontalAlignment' to 'bool'" And when I try to add further code in the RTB's SelectionChanged event for the IncreaseIndentation or DecreaseIndentation button's, i.e., tsbtnIncreaseIndent.Checked = richTextBoxBody.SelectionIndent; it throws the following exception: "Cannot implicitly convert type 'int' to 'bool'" Can anyone provide a suggestion for getting the Checked property of the alignment buttons and the indentation buttons to reflect the contents of the RichTextBox as the cursor moves over text that is aligned and\or indented? Thank you in advance. Richard

    C# csharp tutorial question

  • Getting ToolStrip button's CheckState to reflect text formatting
    U User 2628354

    Hello Eddy: Thanks a lot for your reply. The code gives me exactly what I was looking for and works great. I didn't know how to accomplish this but was fairly certain it could be done. Also, I wasn't sure which event to call it in. Your submission is very much appreciated. Thanks again. Richard

    C# csharp tutorial question

  • Getting ToolStrip button's CheckState to reflect text formatting
    U User 2628354

    Dear Sirs: I have a C# application with a ToolStrip control and a RichTextBox control. Three of the buttons on the toolStrip are for formatting the text in the RichTextBox, i.e., Bold, Italic, and Underlined. I have the CheckOnClick property set to true for these 3-buttons. My code successfully sets the selected text to any\all of the above formatting. However, the button's CheckState remains "Pressed" or clicked, unless I physically unclick it. What I want to do is emulate what occurs in a WordPad document, where by both scrolling over formatted text, or clicking into formatted text causes the Bold button, Italic button, or Underline button(s) to appear depressed or clicked and conversely, to not appear depressed or clicked when the user clicks outside of the formatted text or scrolls past it. Does anyone know how to accomplish this in C# and also what event(s) to place this code in, so that this happens smoothly for the end-user? Thank you in advance for your answer Richard

    C# csharp tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups