protected ListBox SetPopList() { poplst = new ListBox(); poplst.Dock = System.Windows.Forms.DockStyle.Fill; for (int i = 0; i < this.alItems.Count; i++) { neusoft.neuFC.Object.neuObject obj; obj = (neusoft.neuFC.Object.neuObject) this.alItems[i]; string s = ""; s = obj.ID.PadRight(6, ' ') + " " + obj.Name.PadRight(10, ' ') + " " + obj.Memo.PadRight(10, ' ') + " "; try { neusoft.HISFC.Object.Base.ISpellCode Spell = obj as neusoft.HISFC.Object.Base.ISpellCode; try { if (Spell.Spell_Code != null) { s = s + Spell.Spell_Code.PadRight(10, ' '); } } catch {} try { if (Spell.WB_Code != null) { s = s + Spell.WB_Code.PadRight(10, ' '); } } catch {} try { if (Spell.User_Code != null) { s = s + Spell.User_Code.PadRight(10, ' '); } } catch {} } catch {} poplst.Items.Add(s); } poplst.Visible = true; poplst.DoubleClick += new EventHandler(lst_DoubleClick); poplst.KeyDown += new KeyEventHandler(lst_KeyDown); return(poplst); }
protected void ComboBox_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == System.Windows.Forms.Keys.Enter) { if (base.Text == "") { return; } if (base.Text == " " || base.Text == " " || base.Text == " ") { ShowSelectDialog(); return; } try { for (int i = 0; i < alItems.Count; i++) { neusoft.neuFC.Object.neuObject o = (neusoft.neuFC.Object.neuObject)alItems[i]; try { if (o.Name.ToUpper().Trim() == base.Text.ToUpper().Trim()) { base.Text = o.Name; return; } } catch {} try { if (o.ID.ToUpper().Trim() == base.Text.ToUpper().Trim()) { base.Text = o.Name; return; } } catch {} try { if (o.Memo.ToUpper().Trim() == base.Text.ToUpper().Trim()) { base.Text = o.Name; return; } } catch {} try { neusoft.HISFC.Object.Base.ISpellCode Spell = o as neusoft.HISFC.Object.Base.ISpellCode; switch (iSpellCode) { case 0: if (Spell.Spell_Code.ToUpper().Trim() == base.Text.ToUpper().Trim()) { base.Text = o.Name; return; } break; case 1: if (Spell.WB_Code.ToUpper().Trim() == base.Text.ToUpper().Trim()) { base.Text = o.Name; return; } break; case 2: if (Spell.User_Code.ToUpper().Trim() == base.Text.ToUpper().Trim()) { base.Text = o.Name; return; } break; } } catch {} } if (this.isItemOnly) { base.Text = ""; } } catch { if (this.isItemOnly) { base.Text = ""; } } } else if (e.KeyCode == Keys.F2) { iSpellCode++; if (iSpellCode >= 3) { iSpellCode = 0; } QueryType = "拼音码"; switch (iSpellCode) { case 0: QueryType = "拼音码"; this.BackColor = Color.FromArgb(255, 255, 255); break; case 1: this.BackColor = Color.FromArgb(255, 200, 200); QueryType = "五笔码"; break; case 2: this.BackColor = Color.FromArgb(255, 150, 150); QueryType = "自定义码"; break; default: this.BackColor = Color.FromArgb(255, 255, 255); break; } } }