private void Txt_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { SendKeys.Send("{Tab}"); } TextBox txt = (TextBox)sender; if (txt.Tag.ToString() == "1") { if (txt.Text.Trim().Length >= 0) { string str = txt.Text.Trim(); int x = LsModule.IndexOf(str); if (x < 0) { return; } str = lsModulelx[x]; if (str.Trim().Length > 0) { UcContents.Setinfo(ptxt, str); } } } }
private void KeyShortDown(KeyEventArgs e) { StringBuilder keyValue = new StringBuilder { Length = 0 }; keyValue.Append(""); if (e.Control) { keyValue.Append("1-"); } else if (e.Alt) { keyValue.Append("2-"); } else if (e.Shift) { keyValue.Append("3-"); } else { keyValue.Append("0-"); } if ((e.KeyValue >= 33 && e.KeyValue <= 40) || (e.KeyValue >= 65 && e.KeyValue <= 90) || //a-z/A-Z (e.KeyValue >= 112 && e.KeyValue <= 123) || e.KeyValue >= 96 && e.KeyValue == 111) //F1-F12 { keyValue.Append(e.KeyValue); } else if ((e.KeyValue >= 48 && e.KeyValue <= 57)) //0-9 { keyValue.Append(e.KeyValue.ToString().Substring(1)); } else if ((e.KeyValue == 13 || e.KeyValue == 27 || e.KeyValue == 32 || e.KeyValue == 46)) { keyValue.Append(e.KeyValue.ToString()); } string str = keyValue.ToString(); if (str == "1-40" || str == "1-90") { UcContents.Setadd(gr2); //Action Act = // Act.BeginInvoke(null, null); } else if (str == "1-88") { UcContents.SetXg(gr2); } }
public void Init(int id) { Himg._Instimagtwain(ImgView, this.Handle, 0); if (id == 0) { UcConten.Archid = ArchId; ucContents0 = new UcConten(); ucContents0.Dock = DockStyle.Fill; ucContents0.OneClickGotoPage += UcContents0_OneClickGotoPage; gr0.Controls.Add(ucContents0); } else { UcContents.ArchId = ArchId; UcContents.ContentsEnabled = ContentsEnabled; UcContents.ModuleVisible = ModuleVisible; ucContents1 = new UcContents(); ucContents1.Dock = DockStyle.Fill; ucContents1.OneClickGotoPage += UcContents1_OneClickGotoPage; gr0.Controls.Add(ucContents1); } LoadFile(); }