Author Topic: High resolution - Image on button not looking good  (Read 259 times)

0 Members and 1 Guest are viewing this topic.

latour_g

  • Newt
  • Posts: 163
High resolution - Image on button not looking good
« on: February 04, 2021, 03:24:19 PM »
Hi,
I have a problem.  I have a lot of buttons with images on it.  Average size of the image is 18x18 pixels.  They look good on screen resolution of 1920 x 1080 or so but with high resolution they are tiny. 

I realize that I'm using Button.Image and by doing so image can't stretch or zoom.   So I change for Button.BackgroudImage and then I can stretch or zoom the image and it look bigger on high resolution.  Now, the problem is my images look blurry and it doesn't give a clean look to my application.

So my question is how to manage this situation ? How does program control all the icon to look good regardless of the resolution ? Should I have two sets of images, small and large ?

Thank you !

latour_g

  • Newt
  • Posts: 163
Re: High resolution - Image on button not looking good
« Reply #1 on: February 09, 2021, 10:36:01 AM »
I will go with an ImageList.  I will be able to choose the size of my image, 32x32 or 16x16.

Code - C#: [Select]
  1. // this.imageIcones32 is my master list, I want to manage only one
  2.  
  3. // for 32 x 32
  4. ImageList imageNew32 = new ImageList();
  5. imageNew32.ImageSize = new Size(32, 32);
  6.  
  7. for (int i = 0; i < this.imageIcones32.Images.Count; i++)
  8. {
  9.      imageNew32.Images.Add(imageIcones32.Images[i]);
  10. }
  11.  
  12. this.btnRegen.ImageList = imageNew32;
  13. this.btnRegenAll.ImageList = imageNew32;
  14.  
  15. this.btnRegen.ImageIndex = 1;
  16. this.btnRegenAll.ImageIndex = 2;
  17.  
  18. //for 16x16
  19. ImageList imageNew16 = new ImageList();
  20. imageNew32.ImageSize = new Size(16, 16);
  21.  
  22. for (int i = 0; i < this.imageIcones32.Images.Count; i++)
  23. {
  24.      imageNew16.Images.Add(imageIcones32.Images[i]);
  25. }
  26.  
  27. this.btnRegen.ImageList = imageNew16;
  28. this.btnRegenAll.ImageList = imageNew16;
  29.  
  30. this.btnRegen.ImageIndex = 1;
  31. this.btnRegenAll.ImageIndex = 2;
  32.  
  33.