2010. március 14., vasárnap

How to display different icons depending on the screen resolution


Problem/Question/Abstract:

How to display different icons depending on the screen resolution

Answer:

Just check for the current resolution and change the icon handle of the application. Of course, you have to create new icons in your resource. Put this in the project (.DPR) file of your application source:

Application.Initialize;
Application.CreateForm(TForm1, Form1);
case GetDeviceCaps(GetDC(Form1.Handle), HORZRES) of
  640: Application.Icon.Handle := LoadIcon(hInstance, 'ICON640');
  800: Application.Icon.Handle := LoadIcon(hInstance, 'ICON800');
  1024: Application.Icon.Handle := LoadIcon(hInstance, 'ICON1024');
  1280: Application.Icon.Handle := LoadIcon(hInstance, 'ICON1280');
end;
Application.Run;

Nincsenek megjegyzések:

Megjegyzés küldése