mirror of
https://github.com/AdAstra-LD/DS-Pokemon-Rom-Editor.git
synced 2026-08-28 05:44:27 -05:00
Created Custom InputComboBox
This commit is contained in:
32
DS_Map/InputComboBox.cs
Normal file
32
DS_Map/InputComboBox.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DSPRE {
|
||||
public partial class InputComboBox : ComboBox {
|
||||
public InputComboBox() {
|
||||
DropDownStyle = ComboBoxStyle.DropDown;
|
||||
|
||||
AutoCompleteMode = AutoCompleteMode.SuggestAppend;
|
||||
AutoCompleteSource = AutoCompleteSource.ListItems;
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e) {
|
||||
base.OnKeyDown(e);
|
||||
|
||||
if (e.KeyCode == Keys.Enter) {
|
||||
string input = Text;
|
||||
int index = FindStringExact(input.Trim());
|
||||
if (index != -1) {
|
||||
SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public new ComboBoxStyle DropDownStyle {
|
||||
get { return base.DropDownStyle; }
|
||||
set { base.DropDownStyle = ComboBoxStyle.DropDown; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user