I am trying to make a program that will allow a user to view an icon in a PictureBox. I want the user to only be able to open images that are 24x24 pixels.
I would like to put a filter in an OpenFileDialog to only show images that are 24x24. Is there any way to do this? I heard that it may be possible by customizing the OpenFileDialog and using P/Invoke.
You could check the Width
and Height
of the image:
// 'image' is the image you want to check
if(image.Width > 24 || image.Height > 24)
MessageBox.Show("Please select a smaller image!");
else
// This code will always run if the image is smaller than 24x24
Hope this helps!