Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to resize materialswitch #380

Open
RecSpeed opened this issue Feb 4, 2023 · 1 comment
Open

How to resize materialswitch #380

RecSpeed opened this issue Feb 4, 2023 · 1 comment

Comments

@RecSpeed
Copy link

RecSpeed commented Feb 4, 2023

Need small materialswitch

@valimaties
Copy link

I don't think it will be done.
If you want to use this project, you have to fork it and modify controls on your needs.

As an idea, in the controls folder, look for MaterialSwitch class and look for the below constants, modify them and see what you got:

private const int THUMB_SIZE = 22;

private const int THUMB_SIZE_HALF = THUMB_SIZE / 2;

private const int TRACK_SIZE_HEIGHT = (int)(14);
private const int TRACK_SIZE_WIDTH = (int)(36);
private const int TRACK_RADIUS = (int)(TRACK_SIZE_HEIGHT / 2);
....
private const int RIPPLE_DIAMETER = 37;

If I were you, I would redefine those constants as fields, I would create an enumerable, let's say SwitchSize having "small, medium, large" values. Then create a public property to be able to resize the switch control, this property must be visible in design time ([Browsable(true)]), as when you change the size it will automatically change in your form too (change those int fields and call invalidate() in the setter).

Good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants