private void netContextMenuChangeName(object sender, EventArgs e) { MenuItem m = sender as MenuItem; if (m == null) { return; } ContextMenu mr = m.Parent as ContextMenu; if (mr == null) { return; } ProcessingNet n = (ProcessingNet)mr.Tag; FlexibleInputWin fi = new FlexibleInputWin("Net Name", n.name); fi.StartPosition = FormStartPosition.Manual; fi.Location = Cursor.Position; fi.ShowDialog(); if (fi.stringValue != null) { if (fi.stringValue.Length > 0) { n.name = fi.stringValue; } } }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button != MouseButtons.Left) { return; } Vector valueCenter = Vector.V(0, 0); GraphicsUtil.TextPosition tpos = new GraphicsUtil.TextPosition(); GraphicsUtil.dualSplit(ClientSize, _valueSize, scale, ref valueCenter, ref tpos, _titlePos); Rectangle valueR = VectorRect.FromCenterSize(valueCenter, Vector.V(_valueSize)).rectangle; if (valueR.Contains(e.Location)) { // Hit in Value // Show Value Selector Window FlexibleInputWin dw; switch (_inputType) { case RTFlexInputType.String: dw = new FlexibleInputWin(_title, _stringVal); dw.StartPosition = FormStartPosition.Manual; dw.Location = PointToScreen(new Point(0, 0)); dw.ShowDialog(); _stringVal = dw.stringValue; break; case RTFlexInputType.Integer: if (_minVal < _maxVal) { dw = new FlexibleInputWin(_title, ((_unit != null) && (_unit.Length > 0))?_unit:null, (int)_minVal, (int)_maxVal, _intVal); } else { dw = new FlexibleInputWin(_title, ((_unit != null) && (_unit.Length > 0)) ? _unit : null, _intVal); } dw.StartPosition = FormStartPosition.Manual; dw.Location = PointToScreen(new Point(0, 0)); dw.ShowDialog(); _intVal = dw.intValue; break; case RTFlexInputType.Float: if (_minVal < _maxVal) { dw = new FlexibleInputWin(_title, ((_unit != null) && (_unit.Length > 0)) ? _unit : null, _minVal, _maxVal, _floatVal, _format); } else { dw = new FlexibleInputWin(_title, ((_unit != null) && (_unit.Length > 0)) ? _unit : null, _floatVal, _format); } dw.StartPosition = FormStartPosition.Manual; dw.Location = PointToScreen(new Point(0, 0)); dw.ShowDialog(); _floatVal = dw.floatValue; break; } newValue(); Invalidate(); } }