An Easy Way to Handle Images in Different DPIs in WinForms | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (181).NET Core  (28).NET MAUI  (227)Angular  (113)ASP.NET  (49)ASP.NET Core  (81)ASP.NET MVC  (87)Azure  (42)Black Friday Deal  (1)Blazor  (236)BoldSign  (14)DocIO  (24)Essential JS 2  (110)Essential Studio  (200)File Formats  (73)Flutter  (136)JavaScript  (226)Microsoft  (122)PDF  (83)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (964)TypeScript  (33)Uno Platform  (3)UWP  (3)Vue  (46)Webinar  (53)Windows Forms  (59)WinUI  (72)WPF  (163)Xamarin  (159)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (11)Business intelligence  (55)Button  (4)C#  (164)Chart  (147)Chart of the week  (58)Cloud  (15)Company  (440)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (73)Development  (681)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (13)Excel  (43)Extensions  (23)File Manager  (7)Gantt  (21)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (522)Mobile MVC  (9)OLAP server  (2)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (45)Performance  (13)PHP  (2)PivotGrid  (5)Predictive Analytics  (6)Report Server  (3)Reporting  (8)Reporting / Back Office  (9)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (5)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (32)Solution Services  (4)Spreadsheet  (11)SQL  (15)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (406)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (628)What's new  (341)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Working with Images with different DPI in WinForms

An Easy Way to Handle Images in Different DPIs in WinForms

Are you a person who cares about providing crystal clear images to different screens with different DPIs?

If so, this blog will definitely help you to achieve that!

In this blog, we’ll see how to set images of different DPIs to WinForms UI controls that will be automatically chosen with respect to the DPI (dots per inch) of the machine. This will ensure images retain clarity when a single application is deployed to different machines.

In this blog, we’ll use the Syncfusion Ribbon control as an example. The ImageListAdv component will act as the backbone for what we are accomplishing.

The ImageListAdv component is used to store a collection of images. The images are stored based on index, that is, in an array. Other controls that have the Image property can use the image list in order to get the appropriate images. We have classified this approach in two sections:

  • Populating an image list with images for different DPIs.
  • Mapping Ribbon control images with the image list component.

Populating an image list with images for different DPIs

Follow these steps to populate an image list with images for different DPIs:

Step 1: Drag the ImageListAdv component to the designer and navigate to the properties window.

Step 2: In the Images collection, add the desired images. They will act as the default images. Also, these images will be displayed when no DPI images are set by the user.

Please refer to the following screenshot for better understanding.

Properties window showing images collection
Properties window showing images collection

Note: For illustration, consider that we are setting Cut, Copy, and Paste in the 0, first and second index positions, respectively, in the Images collection.

Image Collection Editor dialog
Image Collection Editor dialog

In the meantime, another option named DPIImages collection is present in the properties window and helps to set the images for different DPIs.

Step 1: Click the option and you can see the DPIAwareImage Collection Editor window.

Step 2: Click Add and the DPIAwareImage instance will be created, where you can see the following properties:

  • DPI120Image: Sets the image of the item for 125 scaling and above.
  • DPI144Image: Sets the image of the item for 150 scaling and above.
  • DPI192Image: Sets the image of the item for 200 scaling and above.
  • Index: Maps the index of the default image present in the Images collection bound to the ImageListAdv component here.
DPIImages collection in the Properties dialog
DPIImages collection in the Properties dialog
DPIAwareImage Collection Editor dialog
DPIAwareImage Collection Editor dialog

Note: Continuing with our illustration, for actual images Cut, Copy, and Paste, we need to add images for different DPIs.

So, in DPIAwareImage[0]:

  • Set different Cut images for different DPIs in DPI120Image, DPI144Image, and DPI192Image properties.
  • Map its Index to 0 since Cut image is present in the 0 index of the Images Likewise, do the same for the Copy and Paste images.

Important Note: If you prefer to add Paste images for different DPIs in DPIAwareImage[0], then you must set its Index to 2 since the Paste image is present in the second index of the Images collection.

So, this is how the actual image is mapped with its equivalent images set for different DPIs via the Index property as the key.

Mapping Ribbon control images with the image list component

Follow these steps to map Ribbon control images with image list components:

Step 1: Drag the Ribbon control to the designer.

Step 2: Create a UI with tabs, buttons, and a gallery based on your application requirements.

Step 3: As usual, map the images for the button, drop-down button, split button, and gallery items with the Image collection present in the ImageListAdv component using appropriate index values.

Now, the Ribbon control checks the When attempting to get images from the Images collection, Ribbon control also checks for its relevant DPI images from the DPIImages collection.

If image is available, then appropriate image will be picked for display. If there are no images in the DPIImages collection, then the image in Images collection will be set as default.

Please refer to the following code example.

[Form  Designer Code – C#]

// Initialize image list component and add images to both "Images" and "DPIImages" collections.
private Syncfusion.Windows.Forms.Tools.ImageListAdv imageListAdv1 =  = new 

this.imageListAdv1.Images.AddRange(new System.Drawing.Image[] {

Syncfusion.Windows.Forms.Tools.DPIAwareImage dpiAwareImage1 = new 
Syncfusion.Windows.Forms.Tools.DPIAwareImage dpiAwareImage2 = new 
Syncfusion.Windows.Forms.Tools.DPIAwareImage dpiAwareImage3 = new 

dpiAwareImage1.DPI120Image = 
dpiAwareImage1.DPI144Image = 
dpiAwareImage1.DPI192Image = 
dpiAwareImage1.Index = 0;

dpiAwareImage2.DPI120Image = 
dpiAwareImage2.DPI144Image = 
dpiAwareImage2.DPI192Image = 
dpiAwareImage2.Index = 1;

dpiAwareImage3.DPI120Image = ((System.Drawing.Image)(resources.GetObject("dpiAwareImage3.DPI120Image")));
dpiAwareImage3.DPI144Image = ((System.Drawing.Image)(resources.GetObject("dpiAwareImage3.DPI144Image")));
dpiAwareImage3.DPI192Image = ((System.Drawing.Image)(resources.GetObject("dpiAwareImage3.DPI192Image")));
dpiAwareImage3.Index = 2;

Syncfusion.Windows.Forms.Tools.DPIAwareImage[] {

// Initialize cut, copy, and paste buttons.
private System.Windows.Forms.ToolStripButton cutButton = new 
private System.Windows.Forms.ToolStripButton copyButton = new 
private System.Windows.Forms.ToolStripButton pasteSplitButton = new System.Windows.Forms.ToolStripButton();

// Defining cut button.
this.cutButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.cutButton.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
this.cutButton.Name = "cutButton";
this.cutButton.Size = new System.Drawing.Size(30, 24);
this.cutButton.Text = "Cut";
this.cutButton.Click += new System.EventHandler(this.cutButton_Click);

// Defining copy button.
this.copyButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.copyButton.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
this.copyButton.Name = "copyButton";
this.copyButton.Size = new System.Drawing.Size(39, 24);
this.copyButton.Text = "Copy";
this.copyButton.Click += new System.EventHandler(this.copyButton_Click);

// Defining paste button.
this.pasteSplitButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.pasteSplitButton.Name = "pasteSplitButton";
this.pasteSplitButton.Size = new System.Drawing.Size(38, 76);
this.pasteSplitButton.Text = "Paste";
this.pasteSplitButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.pasteSplitButton.TextImageRelation = 
this.pasteSplitButton.Click += new 

// Adding images to cut, copy, and paste buttons.
this.cutButton.Image = this.imageListAdv1.Images[0];
this.copyButton.Image = this.imageListAdv1.Images[1];
this.pasteSplitButton.Image = this.imageListAdv1.Images[2];


// Adding cut and copy buttons to a separate toolstrip panel.
this.toolStripPanelItem1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

// Adding paste button along with cut and copy buttons to the main toolstrip panel.
this.clipBoardtoolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {

After, executing the above code, we’ll get the output like in the following screenshot.

Ribbon control Output Example
Ribbon control Output Example


Sample link:

Documentation link:


I hope you now have a clear idea of how to work with images for different DPIs in WinForms UI controls. With this feature, you can make sure that no image is blurry in your application in any DPI it is deployed to. Try out this feature to feel the difference!

If you aren’t a customer yet, you can try our 30-day free trial to check out this feature. Also, try our other samples from this GitHub location.

If you wish to send us feedback or would like to submit any questions, please feel free to do so in the comments section below or contact us through our support forumDirect-Trac, or feedback portal. We are always happy to assist you!


Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed