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 / C++ / MFC
  4. Can GDI and RichEdit share the WindowClient (and live together)

Can GDI and RichEdit share the WindowClient (and live together)

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsdebuggingcomhelp
10 Posts 2 Posters 6 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi I have a CrichEditctrl which I am using to display code (as in debugger). When the User whishes to place a breakpoint I TransparentBlt a red bitmap to the left In order to give GDI it own space DeflateRect the Richedit Rect (for the text ) to the left and RcihEdit::SetRect the new smaller size for richedit, Placing the bitmap everything looks fine However when my code reaches to where the breakpoint was set I highlite the line of code with SetSel and SetSelectionCharFormat this has the effect of wiping out the top of the red bullet bitmap which I dont understand Since the SetRect should ensure that it doesnt go out of the rect bounds. I know rich edit has an OLE interface (which can display bitmaps) however with that too I had problem as the bullet shifted the text Thanks

    L F 4 Replies Last reply
    0
    • F ForNow

      Hi I have a CrichEditctrl which I am using to display code (as in debugger). When the User whishes to place a breakpoint I TransparentBlt a red bitmap to the left In order to give GDI it own space DeflateRect the Richedit Rect (for the text ) to the left and RcihEdit::SetRect the new smaller size for richedit, Placing the bitmap everything looks fine However when my code reaches to where the breakpoint was set I highlite the line of code with SetSel and SetSelectionCharFormat this has the effect of wiping out the top of the red bullet bitmap which I dont understand Since the SetRect should ensure that it doesnt go out of the rect bounds. I know rich edit has an OLE interface (which can display bitmaps) however with that too I had problem as the bullet shifted the text Thanks

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

      You should use a mfc splitter window - Google Search[^] and create two client Windows inside your main frame. This allows you to write and draw into each one independently without disturbing the contents of the other(s).

      1 Reply Last reply
      0
      • F ForNow

        Hi I have a CrichEditctrl which I am using to display code (as in debugger). When the User whishes to place a breakpoint I TransparentBlt a red bitmap to the left In order to give GDI it own space DeflateRect the Richedit Rect (for the text ) to the left and RcihEdit::SetRect the new smaller size for richedit, Placing the bitmap everything looks fine However when my code reaches to where the breakpoint was set I highlite the line of code with SetSel and SetSelectionCharFormat this has the effect of wiping out the top of the red bullet bitmap which I dont understand Since the SetRect should ensure that it doesnt go out of the rect bounds. I know rich edit has an OLE interface (which can display bitmaps) however with that too I had problem as the bullet shifted the text Thanks

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        Not able to see the message on the message board saw the email)

        L 1 Reply Last reply
        0
        • F ForNow

          Not able to see the message on the message board saw the email)

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

          Sorry about that, it was not appropriate to the specifics of your question. I cannot remember if you are using MFC or not. If you are then perhaps create your own class that inherits from the RichEdit class. If not then you could use the SubClassWindow function to get control of Windows WM_xxx messages and so modify what gets displayed.

          F 1 Reply Last reply
          0
          • L Lost User

            Sorry about that, it was not appropriate to the specifics of your question. I cannot remember if you are using MFC or not. If you are then perhaps create your own class that inherits from the RichEdit class. If not then you could use the SubClassWindow function to get control of Windows WM_xxx messages and so modify what gets displayed.

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #5

            I am using MFC wondering if by that you mean WM_PAINT or in my case the OnPaint message handler to ensure bitmap is intact

            L 1 Reply Last reply
            0
            • F ForNow

              Hi I have a CrichEditctrl which I am using to display code (as in debugger). When the User whishes to place a breakpoint I TransparentBlt a red bitmap to the left In order to give GDI it own space DeflateRect the Richedit Rect (for the text ) to the left and RcihEdit::SetRect the new smaller size for richedit, Placing the bitmap everything looks fine However when my code reaches to where the breakpoint was set I highlite the line of code with SetSel and SetSelectionCharFormat this has the effect of wiping out the top of the red bullet bitmap which I dont understand Since the SetRect should ensure that it doesnt go out of the rect bounds. I know rich edit has an OLE interface (which can display bitmaps) however with that too I had problem as the bullet shifted the text Thanks

              F Offline
              F Offline
              ForNow
              wrote on last edited by
              #6

              Richard For my GDI display I need the number of rows equal to same number as the original Client suffice on column is enough

              1 Reply Last reply
              0
              • F ForNow

                Hi I have a CrichEditctrl which I am using to display code (as in debugger). When the User whishes to place a breakpoint I TransparentBlt a red bitmap to the left In order to give GDI it own space DeflateRect the Richedit Rect (for the text ) to the left and RcihEdit::SetRect the new smaller size for richedit, Placing the bitmap everything looks fine However when my code reaches to where the breakpoint was set I highlite the line of code with SetSel and SetSelectionCharFormat this has the effect of wiping out the top of the red bullet bitmap which I dont understand Since the SetRect should ensure that it doesnt go out of the rect bounds. I know rich edit has an OLE interface (which can display bitmaps) however with that too I had problem as the bullet shifted the text Thanks

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

                Have a look at the Scintilla library[^]. Last time I used it was nearly 20 years ago. I'm not even sure if Scintilla supports Windows anymore, you might need to do some research. I do see that they mention requiring a C++17 compiler on the website. Some old Codeproject articles about it: Using Scintilla for syntax coloring in MFC[^] CUltraPadWnd - A Simple Syntax Coloring Control Based on the MFC CWnd Class[^]

                F 1 Reply Last reply
                0
                • F ForNow

                  I am using MFC wondering if by that you mean WM_PAINT or in my case the OnPaint message handler to ensure bitmap is intact

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

                  I cannot suggest anything more without spending hours analysing your code. Which is not an option, sorry.

                  F 1 Reply Last reply
                  0
                  • L Lost User

                    I cannot suggest anything more without spending hours analysing your code. Which is not an option, sorry.

                    F Offline
                    F Offline
                    ForNow
                    wrote on last edited by
                    #9

                    I understand I am going to try one more thing all this time I have been using DDX to create the window handle to the richedit. and using the control id it would pick the rect value from the resource file This in a way doesnt make sense. I am going to do a GetClientRect for the parent dialog deflat the recct on the left side then instantiate the Richedit with new and Call the Richedit Create to Create the the richedit with smaller rect

                    1 Reply Last reply
                    0
                    • L Lost User

                      Have a look at the Scintilla library[^]. Last time I used it was nearly 20 years ago. I'm not even sure if Scintilla supports Windows anymore, you might need to do some research. I do see that they mention requiring a C++17 compiler on the website. Some old Codeproject articles about it: Using Scintilla for syntax coloring in MFC[^] CUltraPadWnd - A Simple Syntax Coloring Control Based on the MFC CWnd Class[^]

                      F Offline
                      F Offline
                      ForNow
                      wrote on last edited by
                      #10

                      thanks going try one more thing before bypassing richedit's coloring capabilities

                      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