GDI plus in .net 2.0 advantages


I have a winforms app in .net 1.1 that extensively uses GDI instead
of controls on forms, as there is lot of content.

Now, we are migrating to VS 2005 on .net 2.0.

What are the features of the GDI+ in .net 2.0 that I should look
at leveraging How different is it from the GDI of 1.1


Answer this question

GDI plus in .net 2.0 advantages

  • Abhi Win

    Mattias is right. In fact, there has been a move away from GDI+ for rendering text in controls. A lot of controls have a new property called UseCompatibleTextRendering that indicates whether to use GDI+ or GDI as the renderer for its text. You can also use the Application.SetCompatibleTextRenderedDefault method to set the default for this.

  • Sree2000

    GDI+ isn't a new feature in 2.0, it's been there since .NET 1.0. GDI is the old graphics API part of Win32.

    I don't know if there have been any significand changes to GDI+ in 2.0, but I know that there's now in fact better support for GDI (with the TextRenderer class for example) since some people had problems using GDI+.



  • CharlesJ

    We've also added the DoubleBuffered property on several controls to ease usage of this powerful rendering method.

    See also this post for a comparo of ControlStyle flags and the property. http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=14701&SiteID=1

  • Philip Jaques

    DGV isn't an area of deep expertise for me, but it's highly doubtful you could craft a rendering algorithm significantly more efficient than what is there. Are you using all the right modes for the DGV (virtual) to get the best perf


  • St3veM

    It's funny that something that works unexpected like that, is 'by-design'.

  • Bissy

    I agree! It goes against all the design principles that Microsoft advocates. Just check the usability video and the rest of the series:

    http://www.msdn.microsoft.com/netframework/programming/classlibraries/apiusability/


  • Waseem Aslam

    Yes, I believe I am using the right modes.
    In another instance, I found gdi painting to be lot less memory intensive than user controls. That is why I would like to profile both approaches and compare.

  • Marcel Meijer

    Thanks Erick, that is useful info.

    Another related question.
    I have a datagrid view on in my smart client app that is expected to display 
    a large number of records.
    Client memory is at a premium in my setup, and I would like to optimize that.
    In this scenario, would it make sense to use GDI rendering to replace
    datagrid view control

  • fly_eye

    The BufferedGraphics class is new, it can be used to perform custom double buffering. I use it, for instance, to perform double buffering on non-client area's.

    Mind though, that the BufferedGraphics.Render method does not clip against GDI+ regions:

    http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx feedbackid=9dd77247-66db-4fff-b30e-2a97ba72a89e

    I do have the feeling that GDI+ isn't really a focus for Microsoft anymore, with the arrival of WPF/Avalon. Correct me if I'm wrong, but I believe there are still some outstanding bugs from .NET 1.1 that weren't fixed.

  • GDI plus in .net 2.0 advantages