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. |