How to use the different size images based on current DPI scaling in ToolStripItem?
up vote
0
down vote
favorite
I need to change the image size based on DPI scaling. In my project, i'm using "ToolStripDropDownItem" with images. I'm having different size images for 100DPI and 175 DPI. In 100 DPI (12 * 12 image is using), its working fine.
In 175 DPI, i'm setting another size (24*24)image, its not working fine. It displays as shown in below image. Actually its not original image i think. ToolStrip automatically scaling the image from 100 DPI i think (I don't want it).
Is there any possibility to change the images based on DPI factor?
topBorderToolStripMenu.ImageAlign = ContentAlignment.MiddleLeft;
topBorderToolStripMenu.ImageScaling = ToolStripItemImageScaling.None;
topBorderToolStripMenu.Size = new Size(225,25);
topBorderToolStripMenu.AutoSize = false;
Please find the issue snap shot
ToolStripImage
c# winforms dpi toolstrip toolstripdropdown
add a comment |
up vote
0
down vote
favorite
I need to change the image size based on DPI scaling. In my project, i'm using "ToolStripDropDownItem" with images. I'm having different size images for 100DPI and 175 DPI. In 100 DPI (12 * 12 image is using), its working fine.
In 175 DPI, i'm setting another size (24*24)image, its not working fine. It displays as shown in below image. Actually its not original image i think. ToolStrip automatically scaling the image from 100 DPI i think (I don't want it).
Is there any possibility to change the images based on DPI factor?
topBorderToolStripMenu.ImageAlign = ContentAlignment.MiddleLeft;
topBorderToolStripMenu.ImageScaling = ToolStripItemImageScaling.None;
topBorderToolStripMenu.Size = new Size(225,25);
topBorderToolStripMenu.AutoSize = false;
Please find the issue snap shot
ToolStripImage
c# winforms dpi toolstrip toolstripdropdown
Normally the constrols should be DPI-unaware (use the same size everywhere) and let the environment resize your controls. DPI awareness for WinForms can be adjusted inapp.settings
in newer framework versions: docs.microsoft.com/en-us/dotnet/framework/winforms/…
– taffer
3 hours ago
Devices don't have a "100dpi" or "200dpi" setting. Surely the unit is %, not dpi. 100% is 96 dots per inch. Bitmaps record the DPI of the device when they are created. For a photo it is based on the camera, for a bitmap that is created with a painting program it is based on the video adapter setting. At runtime the image is rescaled to ensure it gets the correct physical size. Go back to your painting program and correct the DPI of those 24x24 images. And ensure you program is dpiAware or they get rescaled twice.
– Hans Passant
3 hours ago
@taffer I have enabled DPI aware using application manifest file in my project.
– keerthi vasan
3 hours ago
I have edited the content for better understand. Please refer it and let me know your ideas.
– keerthi vasan
22 mins ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I need to change the image size based on DPI scaling. In my project, i'm using "ToolStripDropDownItem" with images. I'm having different size images for 100DPI and 175 DPI. In 100 DPI (12 * 12 image is using), its working fine.
In 175 DPI, i'm setting another size (24*24)image, its not working fine. It displays as shown in below image. Actually its not original image i think. ToolStrip automatically scaling the image from 100 DPI i think (I don't want it).
Is there any possibility to change the images based on DPI factor?
topBorderToolStripMenu.ImageAlign = ContentAlignment.MiddleLeft;
topBorderToolStripMenu.ImageScaling = ToolStripItemImageScaling.None;
topBorderToolStripMenu.Size = new Size(225,25);
topBorderToolStripMenu.AutoSize = false;
Please find the issue snap shot
ToolStripImage
c# winforms dpi toolstrip toolstripdropdown
I need to change the image size based on DPI scaling. In my project, i'm using "ToolStripDropDownItem" with images. I'm having different size images for 100DPI and 175 DPI. In 100 DPI (12 * 12 image is using), its working fine.
In 175 DPI, i'm setting another size (24*24)image, its not working fine. It displays as shown in below image. Actually its not original image i think. ToolStrip automatically scaling the image from 100 DPI i think (I don't want it).
Is there any possibility to change the images based on DPI factor?
topBorderToolStripMenu.ImageAlign = ContentAlignment.MiddleLeft;
topBorderToolStripMenu.ImageScaling = ToolStripItemImageScaling.None;
topBorderToolStripMenu.Size = new Size(225,25);
topBorderToolStripMenu.AutoSize = false;
Please find the issue snap shot
ToolStripImage
c# winforms dpi toolstrip toolstripdropdown
c# winforms dpi toolstrip toolstripdropdown
edited 25 mins ago
asked 5 hours ago
keerthi vasan
62
62
Normally the constrols should be DPI-unaware (use the same size everywhere) and let the environment resize your controls. DPI awareness for WinForms can be adjusted inapp.settings
in newer framework versions: docs.microsoft.com/en-us/dotnet/framework/winforms/…
– taffer
3 hours ago
Devices don't have a "100dpi" or "200dpi" setting. Surely the unit is %, not dpi. 100% is 96 dots per inch. Bitmaps record the DPI of the device when they are created. For a photo it is based on the camera, for a bitmap that is created with a painting program it is based on the video adapter setting. At runtime the image is rescaled to ensure it gets the correct physical size. Go back to your painting program and correct the DPI of those 24x24 images. And ensure you program is dpiAware or they get rescaled twice.
– Hans Passant
3 hours ago
@taffer I have enabled DPI aware using application manifest file in my project.
– keerthi vasan
3 hours ago
I have edited the content for better understand. Please refer it and let me know your ideas.
– keerthi vasan
22 mins ago
add a comment |
Normally the constrols should be DPI-unaware (use the same size everywhere) and let the environment resize your controls. DPI awareness for WinForms can be adjusted inapp.settings
in newer framework versions: docs.microsoft.com/en-us/dotnet/framework/winforms/…
– taffer
3 hours ago
Devices don't have a "100dpi" or "200dpi" setting. Surely the unit is %, not dpi. 100% is 96 dots per inch. Bitmaps record the DPI of the device when they are created. For a photo it is based on the camera, for a bitmap that is created with a painting program it is based on the video adapter setting. At runtime the image is rescaled to ensure it gets the correct physical size. Go back to your painting program and correct the DPI of those 24x24 images. And ensure you program is dpiAware or they get rescaled twice.
– Hans Passant
3 hours ago
@taffer I have enabled DPI aware using application manifest file in my project.
– keerthi vasan
3 hours ago
I have edited the content for better understand. Please refer it and let me know your ideas.
– keerthi vasan
22 mins ago
Normally the constrols should be DPI-unaware (use the same size everywhere) and let the environment resize your controls. DPI awareness for WinForms can be adjusted in
app.settings
in newer framework versions: docs.microsoft.com/en-us/dotnet/framework/winforms/…– taffer
3 hours ago
Normally the constrols should be DPI-unaware (use the same size everywhere) and let the environment resize your controls. DPI awareness for WinForms can be adjusted in
app.settings
in newer framework versions: docs.microsoft.com/en-us/dotnet/framework/winforms/…– taffer
3 hours ago
Devices don't have a "100dpi" or "200dpi" setting. Surely the unit is %, not dpi. 100% is 96 dots per inch. Bitmaps record the DPI of the device when they are created. For a photo it is based on the camera, for a bitmap that is created with a painting program it is based on the video adapter setting. At runtime the image is rescaled to ensure it gets the correct physical size. Go back to your painting program and correct the DPI of those 24x24 images. And ensure you program is dpiAware or they get rescaled twice.
– Hans Passant
3 hours ago
Devices don't have a "100dpi" or "200dpi" setting. Surely the unit is %, not dpi. 100% is 96 dots per inch. Bitmaps record the DPI of the device when they are created. For a photo it is based on the camera, for a bitmap that is created with a painting program it is based on the video adapter setting. At runtime the image is rescaled to ensure it gets the correct physical size. Go back to your painting program and correct the DPI of those 24x24 images. And ensure you program is dpiAware or they get rescaled twice.
– Hans Passant
3 hours ago
@taffer I have enabled DPI aware using application manifest file in my project.
– keerthi vasan
3 hours ago
@taffer I have enabled DPI aware using application manifest file in my project.
– keerthi vasan
3 hours ago
I have edited the content for better understand. Please refer it and let me know your ideas.
– keerthi vasan
22 mins ago
I have edited the content for better understand. Please refer it and let me know your ideas.
– keerthi vasan
22 mins ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371438%2fhow-to-use-the-different-size-images-based-on-current-dpi-scaling-in-toolstripit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Normally the constrols should be DPI-unaware (use the same size everywhere) and let the environment resize your controls. DPI awareness for WinForms can be adjusted in
app.settings
in newer framework versions: docs.microsoft.com/en-us/dotnet/framework/winforms/…– taffer
3 hours ago
Devices don't have a "100dpi" or "200dpi" setting. Surely the unit is %, not dpi. 100% is 96 dots per inch. Bitmaps record the DPI of the device when they are created. For a photo it is based on the camera, for a bitmap that is created with a painting program it is based on the video adapter setting. At runtime the image is rescaled to ensure it gets the correct physical size. Go back to your painting program and correct the DPI of those 24x24 images. And ensure you program is dpiAware or they get rescaled twice.
– Hans Passant
3 hours ago
@taffer I have enabled DPI aware using application manifest file in my project.
– keerthi vasan
3 hours ago
I have edited the content for better understand. Please refer it and let me know your ideas.
– keerthi vasan
22 mins ago