This article is a mirror article of machine translation, please click here to jump to the original article.

View: 19011|Reply: 1

[WinForm] toolStrip button to modify the image size

[Copy link]
Posted on 3/4/2015 11:19:18 AM | | |

toolStrip button to modify the image size

1. The button size cannot be modified // This problem is more troublesome to us, why can't it be modified, maybe we didn't consider that we want to modify the button size at that time

You can modify the height of the button by simply changing one of the toolStrip properties, autosize, to false

2. The picture of the button cannot be modified // This is also a big problem

ImagesCaling is set to none to modify the image size

3.displaystyle can control whether the display text or the picture is both

4. Implement the icon to become larger when hovering.

Write like this:
toolStripButton1.ImageScaling = ToolStripItemImageScaling.None;
This property defaults to SizeToFit, which automatically scales the icon image to the appropriate size of toolStrip.
This value is more appropriate when the AutoSize of the toolStrip is false and you specify the length and width of the toolStrip. None indicates that the icon uses the original size of the Image, and if the Image is taller/wider than the toolStrip, the excess is not visible.

So if you want to enlarge the icon image at runtime, you need to prepare an image of a suitable size.
For example, the system adds toolStrip height to 25 by default, you can turn off toolStrip's AutoSize and adjust the height to 31, the icons are 24x24, when SizeToFit it will become 16x16, when you need to zoom in, change the ImageScaling of this item to None will be restored back to 24x24.

Finally, the layout is best done with the toolStrip's Padding and LayoutStyle properties.

Finally, if you want to change the icon arbitrarily...... Or change ImageScaling and find a few sets of icons of different sizes, and write the Image attributes to the children when needed.




Previous:I saw on the Internet that Alibaba Cloud filing is easy to be deregistered with other CDNs
Next:Alibaba was ordered to withdraw from Taiwan
Posted on 3/4/2015 12:35:31 PM |
learned
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com