Hi
I added a png to a button. The png is visible on the button, but it ist stretched to fit the height of the button which looks quite awful. What can i do?
The default size of the image is set in the theme. The reason is that we support SVG icons and usually SVG icons have a very large natural size. Also, it’s a lot more convenient to normalize the size instead of having to manually resize all icons as you’d have to do with WinForms.
However, there are several ways (as usual with Wisej) to personalize the default behavior, here are two alternatives:
{ "appearances": { // button with 16x16 icons "button-16x16": { "inherit": "button", "components": { "icon": { "states": { "default": { "properties": { "scale": true, "width": 16, "height": 16 } } } } } } } }
Note the “scale”:true property. If you set it to false, the theme engine tries to maintain the aspect ratio of the image and you can enforce the height or the width.
Using the image list allows you to reuse the same list for multiple buttons and to choose the size for each list – and you don’t have to resize the images.
Using the theme mixin lets you control more theme aspects, and you can create a button class with the customized appearance.
HTH
Best,
Luca
Hi Luca
the problem is, that small images are scaled up, as far as I saw all images smaller than 24×24 px are scaled up. Is there a way to prevent this behavior?
Hi Gunter,
I have added a small example here: https://wisej.com/examples that shows some of the many options and combinations with images. Looks like this:
If it sill doesn’t work for you please attach a sample app.
Best,
Luca