Displaying small Icon on top of a Control (in Design Mode)

I have a standalone forms designer up and running ( using the new designsurface).
For some of my custom controls, that get created using my custom designer, I want to display some small icons on top of their drawing surface.
I solved that for some "label" like controls by overriding their Paint() Method and draw some bitmap on top of them.
But for some other controls I have (checkboxes,...) i cant properly paint over their drawing surfaces, because the space is simply to small.
How can i paint some small icons beside or top of a control (something like the small "smart tag" arrow in VS 2005)



Answer this question

Displaying small Icon on top of a Control (in Design Mode)

  • rowdy2

    Sorry about that -- Mick's.

  • SamSam698

    It was done by creating NativeWindow or any type of floating controls that is placed besides the control it is designing. The easiest to code is a floating control, it's like showing a tooltip in design-time with extra functionalities and different painting.

    -chris

  • VidyaMN

    In VS2005, if you create a custom Designer for your control then you can draw glyphs anywhere on the screen.

    I don't have VS2005 installed on this machine so I can't help out with an example.

    There is an example in MSDN which can be modified to do what you want:

    http://msdn2.microsoft.com/en-us/library/ms171820.aspx


  • Jeff Abraham - MSFT

    I Don't know about the smart-tags drawing, but the exception looks like a form with some custom drawing on it,

     

    Anyway, this is microsoft that creates the smart-tag, on a microsoft envirmonet, so I guess they can do more that us....



  • stockcrack

    I've read the link given by Mick, and I agree, it is much easier that way than handling floating controls.

    -chris

  • dukerattlehead

    That's exactly what you want to do.

    Martin

    WinForms Dev Lead



  • zeifer

    I Can't paint on a control outsize of its ClientRectangle, so the icon must be inside it, regarding controls that you can't draw an icon, extends the checkbox, and paint it your self using the CheckBoxRenderer (http://msdn2.microsoft.com/en-us/library/system.windows.forms.checkboxrenderer.aspx).

    If you need more guidance about this, replay and I'll go more detailed example.

  • Lou Immendorf

    Is there no way to paint in the space surrounding a control
    How are the smart tag arrows made
    Or how would you make something like the new exception assistant in vs 2005
    But thanks for the checkbox example. I will take a look at that

  • Anu Narayan

    Which one do you mean, Chris's or Mick's suggestion

  • Displaying small Icon on top of a Control (in Design Mode)