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
  1. Home
  2. General Programming
  3. C#
  4. Not sure if RichTextBox can do this?

Not sure if RichTextBox can do this?

Scheduled Pinned Locked Moved C#
htmltutorialquestion
10 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dewald
    wrote on last edited by
    #1

    Hi all, I want to put some info into a RichTextBox (or whichever other control might serve the purpose better) consisting of different sections. I was hoping to put a horizontal seperator between sections but I'm not sure how to do that. I'm probably missing something very simple here. I'm thinking of something similar to the


    tag of HTML. Any ideas? Thanks in advance Dewald

    L M L P 4 Replies Last reply
    0
    • D Dewald

      Hi all, I want to put some info into a RichTextBox (or whichever other control might serve the purpose better) consisting of different sections. I was hoping to put a horizontal seperator between sections but I'm not sure how to do that. I'm probably missing something very simple here. I'm thinking of something similar to the


      tag of HTML. Any ideas? Thanks in advance Dewald

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Use SplitContainer then put 2 RichTextBox in each panel.

      D 1 Reply Last reply
      0
      • D Dewald

        Hi all, I want to put some info into a RichTextBox (or whichever other control might serve the purpose better) consisting of different sections. I was hoping to put a horizontal seperator between sections but I'm not sure how to do that. I'm probably missing something very simple here. I'm thinking of something similar to the


        tag of HTML. Any ideas? Thanks in advance Dewald

        M Offline
        M Offline
        MohammadAmiry
        wrote on last edited by
        #3

        No, a richtextbox (as it is) cannot be split. But you may have a control, which consists of two richtextboxes and a seperator between them. You may program different interactions between these two controls to give the user the feel that they are one split richtextbox (if you need such thing).

        D 1 Reply Last reply
        0
        • L Lost User

          Use SplitContainer then put 2 RichTextBox in each panel.

          D Offline
          D Offline
          Dewald
          wrote on last edited by
          #4

          Thanks, that would be an idea but I will be adding text (in various sections) at runtime and will not know beforehand how many sections (and horizontal seperators) there will evetually be. So it is important that I am able to add seperators at runtime.

          1 Reply Last reply
          0
          • M MohammadAmiry

            No, a richtextbox (as it is) cannot be split. But you may have a control, which consists of two richtextboxes and a seperator between them. You may program different interactions between these two controls to give the user the feel that they are one split richtextbox (if you need such thing).

            D Offline
            D Offline
            Dewald
            wrote on last edited by
            #5

            Thanks, but just to be clear, I'm not looking for a split-line (or whatever you call it) with which the sections can be resized etc. I want to simly draw a horizontal black line across the width of the control and continue with more text under that. The easiest way would be to add a bunch of underscores or minusses to the textbox but I was hoping for something more elegant.

            1 Reply Last reply
            0
            • D Dewald

              Hi all, I want to put some info into a RichTextBox (or whichever other control might serve the purpose better) consisting of different sections. I was hoping to put a horizontal seperator between sections but I'm not sure how to do that. I'm probably missing something very simple here. I'm thinking of something similar to the


              tag of HTML. Any ideas? Thanks in advance Dewald

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              Hi, I have not done this myself, but it sounds like you want a ListBox (great at holding a number of items of any kind), where each item could be a RichTextBox. Make it UserDrawn and you can add RTB's as much as you want, they will be layed ou one below the other, and scrolling will be automatic. :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


              D D 2 Replies Last reply
              0
              • L Luc Pattyn

                Hi, I have not done this myself, but it sounds like you want a ListBox (great at holding a number of items of any kind), where each item could be a RichTextBox. Make it UserDrawn and you can add RTB's as much as you want, they will be layed ou one below the other, and scrolling will be automatic. :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


                D Offline
                D Offline
                Dewald
                wrote on last edited by
                #7

                Hey, I think you may be on to something. I'll try this out and report back. Thanks.

                1 Reply Last reply
                0
                • L Luc Pattyn

                  Hi, I have not done this myself, but it sounds like you want a ListBox (great at holding a number of items of any kind), where each item could be a RichTextBox. Make it UserDrawn and you can add RTB's as much as you want, they will be layed ou one below the other, and scrolling will be automatic. :)

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


                  D Offline
                  D Offline
                  DaveyM69
                  wrote on last edited by
                  #8

                  Good idea Luc - interesting concept. I can imagine this being extremely usefull in lots of situations. Dewald - post back if you get it to work (maybe with a little code snippet?). This is going on my todo list for when I get a little time :-D

                  Dave

                  D 1 Reply Last reply
                  0
                  • D DaveyM69

                    Good idea Luc - interesting concept. I can imagine this being extremely usefull in lots of situations. Dewald - post back if you get it to work (maybe with a little code snippet?). This is going on my todo list for when I get a little time :-D

                    Dave

                    D Offline
                    D Offline
                    Dewald
                    wrote on last edited by
                    #9

                    OK, I'm making progress but it's painfully slow. Was hoping someone could give me a nudge in the right direction. I'm at the point now where I'm trying to paint the RichTextBox in the ListBox (in the DrawItem event of course). The nearest I've come so far is to use the e.Graphics.DrawImage() method but obtaining an Image of the RichTextBox is proving tricky. I'm sure there has to be a better way than importing the gdi32.dll and bit blasting the control onto an image (as explained here[^]) which is then drawn into the ListBox. Any ideas?

                    1 Reply Last reply
                    0
                    • D Dewald

                      Hi all, I want to put some info into a RichTextBox (or whichever other control might serve the purpose better) consisting of different sections. I was hoping to put a horizontal seperator between sections but I'm not sure how to do that. I'm probably missing something very simple here. I'm thinking of something similar to the


                      tag of HTML. Any ideas? Thanks in advance Dewald

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #10

                      Why not use the Web Browser component in edit mode?

                      Deja View - the feeling that you've seen this post before.

                      My blog | My articles

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

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