Search code examples
c#winforms.net-2.0

Why are my graphics degraded when I load my Form at runtime


I have made a winform application for use within the company I work for( web site was not an option) The user base of this application has increased and of course it has become a pain to upgrade everyone...even more now since users are now disallowed form installing their own applications.

I came up with the idea of keeping the application stored on a database to be loaded upon execution. It all works fine, but it seems that the graphics have a pre-windows7 (on win7 machines) look to them. Why would that be happening?

      System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFile(assemblyPath);
      Type type = assembly.GetType(typeName);
      Form form = (Form)Activator.CreateInstance(type);
      Application.Run(form);

Solution

  • Call Application.EnableVisualStyles before any controls are created, prior to loading the assembly.