none
Is it possible to paint in vs2008 code window?

    Question

  • As described in title, how to achieve this in vs2008? Is it possible?  I know it can be done with vs2010 MEF, but I have no idea how to do it in vs2008. Can anyone give me some help?

    Monday, February 13, 2012 4:52 AM

Answers

  • Scott, the code editor was completely rewritten in VS 2010, and is actually implemented with WPF. While you can render adornments and other elements in the code editor in VS 2010, there is NO supported way to extend the earlier editor in a similar fashion.

    The older editor is entirely Win32 based and with the exception of some ability render custom glyphs in the widget bar, there is no support for drawing directly to the code editor's HWND. You would essentially have to hijack and handle the WM_PAINT message on the underlying Win32 HWND (something we do not support, nor recommend attempting).

    Sincerely,


    Ed Dore

    Thursday, February 16, 2012 10:20 PM
    Moderator
  • Hi Scott,

    Correct. There simply are not any extensibility interfaces or hooks into the older code editor that allow you to do so. As soon as one or more 'extensions' start subclassing the underlying Win32 HWND to handle messages of any kind, all bets are off. You have zero control over whoever else might try something similar. This is why it's unsupported, and definitely not recommended.

    Sincerely,


    Ed Dore

    Saturday, February 18, 2012 11:10 PM
    Moderator

All replies

  • Hi scott,
    You also can achieve this in VS2008.
    The VS2008 also has MEF.
    You can refer to the following articles:
    MEF for Beginner (concept) - part 1
    http://blogs.microsoft.co.il/blogs/bnaya/archive/2009/11/28/mef-for-beginner-concept-part-1.aspx
    MEF for Beginner – Part 2 (VS 2008)
    http://blogs.microsoft.co.il/blogs/bnaya/archive/2009/12/05/mef-for-beginner-part-2-vs-2008.aspx

    Best regards,
    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, February 14, 2012 7:58 AM
    Moderator
  • Thank you, lucy. I have read the articles you provide. But I mean vs2008 itself doesn't support MEF. I think if you want to use MEF in visuao studio, vs itself must know call export objects. VS2010 is designed to do this while VS2008 not. Or did I misunderstanding?
    Thursday, February 16, 2012 1:20 AM
  • Scott, the code editor was completely rewritten in VS 2010, and is actually implemented with WPF. While you can render adornments and other elements in the code editor in VS 2010, there is NO supported way to extend the earlier editor in a similar fashion.

    The older editor is entirely Win32 based and with the exception of some ability render custom glyphs in the widget bar, there is no support for drawing directly to the code editor's HWND. You would essentially have to hijack and handle the WM_PAINT message on the underlying Win32 HWND (something we do not support, nor recommend attempting).

    Sincerely,


    Ed Dore

    Thursday, February 16, 2012 10:20 PM
    Moderator
  •  Ed Dore,Thanks. So, it is hard to achieve it in vs2008? Anyway, I will try the not recommend way, just for fun! Thanks again.
    Saturday, February 18, 2012 5:02 AM
  • Hi Scott,

    Correct. There simply are not any extensibility interfaces or hooks into the older code editor that allow you to do so. As soon as one or more 'extensions' start subclassing the underlying Win32 HWND to handle messages of any kind, all bets are off. You have zero control over whoever else might try something similar. This is why it's unsupported, and definitely not recommended.

    Sincerely,


    Ed Dore

    Saturday, February 18, 2012 11:10 PM
    Moderator