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. CRichedit and CDC

CRichedit and CDC

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsdebuggingcsharpvisual-studiojson
5 Posts 3 Posters 1 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 been able to format all my text. via Streamin, Next thing I would like to draw is bitmap breakpoint I mean like in the visual studio debugger. I think the examples of using the richeditole interface is if you streamin SF_RTF mine was done as text SF_TEXT. I thinking of getting the richedit DC via CWnd::GetDC and maybe draw an ellipse I think if i draw it on the richedit itself it might misalign the rest of the text a line, then there is the option of drawing it on the side of the dialog box though when I page up and down the text I would have to erase and re-draw if anyone has any ideas how to go about this, I would appreciate it. But as I said most of the examples, I saw for drawing in richedit was streaming with SF_RTF THANKS

    U 1 Reply Last reply
    0
    • F ForNow

      Hi I have been able to format all my text. via Streamin, Next thing I would like to draw is bitmap breakpoint I mean like in the visual studio debugger. I think the examples of using the richeditole interface is if you streamin SF_RTF mine was done as text SF_TEXT. I thinking of getting the richedit DC via CWnd::GetDC and maybe draw an ellipse I think if i draw it on the richedit itself it might misalign the rest of the text a line, then there is the option of drawing it on the side of the dialog box though when I page up and down the text I would have to erase and re-draw if anyone has any ideas how to go about this, I would appreciate it. But as I said most of the examples, I saw for drawing in richedit was streaming with SF_RTF THANKS

      U Offline
      U Offline
      unitedsol zain
      wrote on last edited by
      #2

      There are a few ways you can add a bitmap breakpoint image to your RichEdit control while still using the SF_TEXT format.

      One way is to use the RichEdit control's built-in support for OLE objects. You can create an OLE object that contains the bitmap image and insert it into the RichEdit control at the desired location. Here is an example of how you can do this:

      // Create an OLE object that contains the bitmap image
      COleClientItem* pItem = m_richEditCtrl.GetDocument()->CreateObject("", "Bitmap");
      if (pItem)
      {
      // Get the bitmap image from a file or resource
      CBitmap bmp;
      bmp.LoadBitmap(IDB_BITMAP);
      pItem->SetBitmap(bmp);

      // Insert the OLE object into the RichEdit control
      long nStartChar, nEndChar;
      m\_richEditCtrl.GetSel(nStartChar, nEndChar);
      m\_richEditCtrl.ReplaceSel((LPCTSTR)pItem->GetItemData(), TRUE);
      

      }

      Another way is to insert a special string that represents the breakpoint image into the RichEdit control and then use the RichEdit's IRichEditOleCallback interface to handle the special string. When the RichEdit control encounters the special string, it calls the IRichEditOleCallback interface to handle it. You can use this callback interface to draw the bitmap image at the desired location. Here is an example of how you can do this:

      class CRichEditBreakpointCallback : public IRichEditOleCallback

      F 1 Reply Last reply
      0
      • U unitedsol zain

        There are a few ways you can add a bitmap breakpoint image to your RichEdit control while still using the SF_TEXT format.

        One way is to use the RichEdit control's built-in support for OLE objects. You can create an OLE object that contains the bitmap image and insert it into the RichEdit control at the desired location. Here is an example of how you can do this:

        // Create an OLE object that contains the bitmap image
        COleClientItem* pItem = m_richEditCtrl.GetDocument()->CreateObject("", "Bitmap");
        if (pItem)
        {
        // Get the bitmap image from a file or resource
        CBitmap bmp;
        bmp.LoadBitmap(IDB_BITMAP);
        pItem->SetBitmap(bmp);

        // Insert the OLE object into the RichEdit control
        long nStartChar, nEndChar;
        m\_richEditCtrl.GetSel(nStartChar, nEndChar);
        m\_richEditCtrl.ReplaceSel((LPCTSTR)pItem->GetItemData(), TRUE);
        

        }

        Another way is to insert a special string that represents the breakpoint image into the RichEdit control and then use the RichEdit's IRichEditOleCallback interface to handle the special string. When the RichEdit control encounters the special string, it calls the IRichEditOleCallback interface to handle it. You can use this callback interface to draw the bitmap image at the desired location. Here is an example of how you can do this:

        class CRichEditBreakpointCallback : public IRichEditOleCallback

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

        As I have stated in my question the OLE interfaace only works SF_RTF my text was streamed in SF_TEXT I have decided to copy Visual Studio the code is probably in SF_TEXT if you look around the code there is a frame possibly a dialogbox frame the breakpoint is probably and CDC::Ellipse. bitmaps seem to have a 3d look With SF_TEXT you cann't draw in the rich edit it messes up the text. I drew on side of the adjoining dialogbox box frame what I really needed was the y coordinates got the from PosFromChar the x I can determine from the width of the dialogbox frame thank you

        L 1 Reply Last reply
        0
        • F ForNow

          As I have stated in my question the OLE interfaace only works SF_RTF my text was streamed in SF_TEXT I have decided to copy Visual Studio the code is probably in SF_TEXT if you look around the code there is a frame possibly a dialogbox frame the breakpoint is probably and CDC::Ellipse. bitmaps seem to have a 3d look With SF_TEXT you cann't draw in the rich edit it messes up the text. I drew on side of the adjoining dialogbox box frame what I really needed was the y coordinates got the from PosFromChar the x I can determine from the width of the dialogbox frame thank you

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

          Ignore answers from that person. We are fairly sure that they are creating answers by using the AI site ChatGPT.

          F 1 Reply Last reply
          0
          • L Lost User

            Ignore answers from that person. We are fairly sure that they are creating answers by using the AI site ChatGPT.

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

            Thanks Richard’s it looks really nice wish I could post a .jpg

            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