private void btnKey_MouseDown(object sender, MouseEventArgs e) { #region Button pressed state LabelControl control = (LabelControl)sender; control.BackColor = this.buttonForeColor; //Color.FromKnownColor(KnownColor.Control); control.ForeColor = this.buttonBackColor; //Color.Black; control.Refresh(); #endregion #region Find link item int[] values = (int[])control.Tag; int row = values[0]; int col = values[1]; TouchLinkItem item = Get(row, col); #endregion #region Raise an event bool cancel = false; if (EventKeyDown != null) { try { EventKeyDown(control, e, item, ref cancel); } catch { } } //else { System.Threading.Thread.Sleep(100); } #endregion #region Trip to next button if (!cancel) { ButtonsCalc(row, col); } else { ButtonsDrawChildren("ROOT"); } #endregion #region Button unpressed state control.BackColor = this.buttonBackColor; // Color.FromKnownColor(KnownColor.ControlDarkDark); control.ForeColor = this.buttonForeColor; // Color.White; control.Refresh(); #endregion }
internal ArrayList GetPath(string key) { ArrayList list = new ArrayList(); TouchLinkItem item = (TouchLinkItem)_links[key]; while (item != null) { list.Insert(0, new string[] { item.parentkey, item.text }); item = (TouchLinkItem)_links[item.parentkey]; } return(list); }
internal TouchLinkItem Get(int row, int col) { TouchLinkItem ret = null; foreach (TouchLinkItem item in _links.Values) { if (item != null && item.parentkey == _currentkey && item.row == row && item.col == col) { ret = item; break; } } return(ret); }
internal void ButtonsCalc(int row, int col) { TouchLinkItem item = Get(row, col); if (item == null) { return; } bool success = ButtonsDrawChildren(item.key); if (success) { _currentkey = item.key; } }
public bool Remove(string key) { bool success = false; TouchLinkItem item = (TouchLinkItem)_links[key]; if (item != null) { _links.Remove(key); if (item.bitmap != null) { item.bitmap.Dispose(); } success = true; } return(success); }
public bool Add(string parentkey, string key, int row, int col, string text, string desc = null, Bitmap bitmap = null, string dll = null, string cls = null) { if (_links.ContainsKey(key)) { return(false); } TouchLinkItem link = new TouchLinkItem(); link.parentkey = (string.IsNullOrEmpty(parentkey) ? "ROOT" : parentkey); link.key = key; link.row = row; link.col = col; link.text = text; link.description = desc; link.bitmap = bitmap; link.dll = dll; link.cls = cls; _links[key] = link; return(true); }