///<summary> /// OnCellMouseDown ///</summary> ///<param name="e"></param> public virtual void OnCellMouseDown(MouseEventArgs e) { //_Cell.SuperGrid.Name MyState sState = GetHitItem(e.Location); if (sState != null) { if (lstScrapperGrids.Contains(_Cell.SuperGrid.Name)) { frmScrapper.Action(_Cell.GridPanel, sState.ColorIndex, _Cell.RowIndex); } //else if (_Cell.SuperGrid.Name == "sdgvArchive") //{ // if (_Cell.Value != null && _Cell.Value.ToString().Length > 0) // _Cell.Value = _Cell.Value.ToString() == "5" ? "1" : "5"; //} else { if (_Cell.Value != null && _Cell.Value.ToString().Length > 0) { _Cell.Value = _Cell.Value.ToString() == "2" ? "4" : "2"; } } OnMouseDown(e); } }
/// <summary> /// Handles MouseMove events /// </summary> /// <param name="e"></param> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); _HitItem = GetHitItem(e.Location); if (_HitItem != _LastHitItem) { _LastHitItem = _HitItem; Invalidate(); } }
/// <summary> /// Handles MouseUp events /// </summary> /// <param name="e"></param> protected override void OnMouseUp(MouseEventArgs e) { // Change the state colorIndex // if the user clicked on an item. if (_MouseDownItem != null && _MouseDownItem == _HitItem) { _MouseDownItem.ColorIndex = (_MouseDownItem.ColorIndex + 1) % imageList1.Images.Count; OnValueChanged(); } _MouseDownItem = null; base.OnMouseUp(e); }
/// <summary> /// Sets the states "string" value /// </summary> /// <param name="value"></param> private void SetStates(string value) { if (value == null || value == string.Empty) { _States = null; } else { string[] states = value.Split(','); _States = new MyState[states.Length]; int i = 0; foreach (string s in states) { int n; int.TryParse(s, out n); _States[i++] = new MyState(n); } } _NeedRecalc = true; }
/// <summary> /// Handles MouseDown events /// </summary> /// <param name="e"></param> protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); _MouseDownItem = _HitItem; }