如何防止ComboBox滚动?C#

Chr*_*ris 1 c# scroll combobox winforms

我有一个ComboBox.用户无法意外滚动并更改所选值至关重要.

如何在使用滚动时阻止ComboBox更改值和文本?谢谢.

Visual Studio 2008

Joh*_*ies 8

combobox.MouseWheel += new MouseEventHandler(combobox_MouseWheel);

void combobox_MouseWheel(object sender, MouseEventArgs e)
{
    ((HandledMouseEventArgs)e).Handled = true;
}
Run Code Online (Sandbox Code Playgroud)