leocb / MaterialSkin

Theming .NET WinForms, C# or VB.Net, to Google's Material Design Principles.
MIT License
438 stars 132 forks source link

MaterialCheckBox ReadOnly (added) #217

Closed valimaties closed 2 years ago

valimaties commented 2 years ago

Hi. I have downloaded project in my Visual Studio and I have made a little "refreshing" on MaterialCheckBox object, because I needed ReadOnly option.

So, In MaterialCheckBox.cs file I have added in properties:

[Browsable(true)]
public bool ReadOnly { get; set; }

private CheckState _oldCheckState;

In OnCreateControl event I have added these lines of code:

// In MouseEnter event added line:
 _oldCheckState = CheckState;

// In MouseDown, MouseUp, KeyDown, KeyUp events I have added line:
if (ReadOnly) CheckState = _oldCheckState;

This is how it works: CheckBoxReadOnly

Regards, Vali

orapps44 commented 2 years ago

Hi,

Thank you for you're work. It looks good.

Did you consider to user Enabled property instead ? From my point of view Enabled property helps user to see a control isn't active for modification.

However if otheres are interested by read-only property, I suggest you to prepare a Pull request.

valimaties commented 2 years ago

Thank you, @orapps44 . I've considered Enabled property, but disabled color is not so friendly and not so visible as the colored object. I have made some applications and user's feedback was to not use that object as disabled, but to make them "unchangeable". So I added ReadOnly property in CheckBox object and they are happy now.

I'm really not so familiarized with github options, I don't know how to make pull requests. That's why I've posted code here...

Regards, Vali

Edited: I've looked to a video on youtube and I understood how a pull request is made. I've created a pull request. Thanks.