0

私はそのようにネストされたコントロールレイアウトを持っています:

Form (ユーザー フォーム) > TabControl > UserControl (自動スクロール、ドッキング フィル) > GroupBox (ドッキング トップ) > ComboBox

UX の問題の 1 つは、ほとんどの場合、入力ボックスの 1 つにフォーカスがあることです。入力ボックスがコンボボックスの場合、コンボボックスは選択を変更しますが、これは望ましくありません。UserControl をスクロールしている間、スクロールでコンボボックスにフォーカスを合わせておきたいと思います。

私は試した

combobox.MouseWheel += (s, e) => combobox.Parent.Focus();

しかし、これは選択が変更された後に発生するようです。一方、TextBox は問題なく動作します。コンボボックスをマウスホイールの TextBox のように動作させる方法はありますか?

4

1 に答える 1

1

I had a scenario like this a few months back: I had ribbon tabs, buttons, textboxes,comboboxes in each tab. I wanted to scroll down and up with my mouse wheel (for the combobox), but instead, my mouse wheel changed the tabs. It didnt affect the combobox.

I then created my own class that inherits from that Ribbon control.

public class MyRibbon : Ribbon {

  public bool DisableMouseWheel { get; set; }

  protected override void OnMouseWheel(MouseEventArgs e) {
    if (!this.DisableMouseWheel) {
      base.OnMouseWheel(e);
    }
  }
}

I then Rebuild my solution. Clicked on the "Show All Files" button from the Solution Explorer and opened the designer file for the form. There were \two lines in the file that referenced the Ribbon type,I replaced the type with the new MyRibbon class.

Then I subscribed to the ComboBox's Enter and Left events where I changed the DisableMouseWheel property.

于 2013-01-10T07:14:07.393 に答える