CRichedit and CDC
-
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
-
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
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
-
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
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
-
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
-
Ignore answers from that person. We are fairly sure that they are creating answers by using the AI site ChatGPT.