leocb / MaterialSkin

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

Visual studio crushes when open TextBox's ContextMenu Items #230

Closed valimaties closed 3 years ago

valimaties commented 3 years ago

Hi. Searching for an option to hide ContextMenu from MaterialTextBox (I don't want to see ContextMenu when control is ReadOnly), I discovered that Visual Studio will crush when I want to see Items of ContextMenu.

valimaties commented 3 years ago

I forgot to write this happening in design mode.

Solving my problem: I've added a property to hide context menu and seems to work fine for me!

private bool _ShowContextualMenu;

[Browsable(true)]
[DisplayName("ShowContextualMenu")]
public bool ShowContextualMenu
{
    get => _ShowContextualMenu;
    set
    {
        _ShowContextualMenu = value;
        if (!value)
        {
            ContextMenuStrip = null;
        }
        Invalidate();
    }
}
orapps44 commented 3 years ago

Added in PR #233.

Use property ShortcutsEnabled to enable or disable contextmenu and keyboard shortcuts.