Смотрите видео ниже, чтобы узнать, как установить наш сайт в качестве веб-приложения на домашнем экране.
Примечание: Эта возможность может быть недоступна в некоторых браузерах.
Are you looking to make the button icon appear correctly on high DPI displays? If so, you can use theHow to make button icon to be dpi-aware in C# .NET Core Windows Forms application?
AutoScaleMode
property of the form to automatically scale the button and its icon based on the DPI of the display. AutoScaleMode
property to Dpi
in C#:this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
AutoScaleMode
property to Dpi
in the designer by selecting the form and setting the property in the Properties window.AutoScaleMode
property to Dpi
, the button and its icon should be automatically scaled to appear correctly on high DPI displays.If setting theIt doesn't help. The button changes its size while the button's image preserves its size.
Any other suggestion?
AutoScaleMode
property to Dpi
doesn't work, you can try manually scaling the button icon based on the current DPI. Here's an example of how to do this:Image
property to the desired icon.Load
event handler, calculate the current DPI and scale the button icon accordingly:float dpiScaleFactor = CreateGraphics().DpiX / 96f; // Calculate DPI scale factor
button1.Image = new Bitmap(button1.Image, new Size((int)(button1.Image.Width * dpiScaleFactor), (int)(button1.Image.Height * dpiScaleFactor))); // Scale button icon