Button on image change is larger than button size

shams 21 Reputation points

in vb.net 2019
when i press the button , the button image change and thats ok
but the problem that when the image i loaded it is out of button size
i try the code:

button1.Image = My.Resources.Closed_position_vertical
button1.BackgroundImageLayout = ImageLayout.Stretch
button1.ImageAlign = ContentAlignment.MiddleCenter

but it not achieve the target

An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,637 questions
{count} votes