public void Draw(int dataIndex, Point cursorPos) { if (_isVisible && ReplicateIndex != dataIndex) { Hide(); } if (_isVisible && ReplicateIndex == dataIndex) { return; } if (_table == null || _table.Count == 0) { return; } ReplicateIndex = dataIndex; var basePoint = new UserPoint(dataIndex + 1, _parent.GetDataSeries()[ReplicateIndex] / _parent.YScale, _parent); using (var g = _parent.GraphSummary.GraphControl.CreateGraphics()) { var size = _table.CalcDimensions(g); var offset = new Size(0, -(int)(size.Height + size.Height / _table.Count)); if (_tip == null) { _tip = new NodeTip(_parent); } _tip.SetTipProvider(TipProvider, new Rectangle(basePoint.Screen(offset), new Size()), cursorPos); } _isVisible = true; }
public bool MoveMouse(MouseButtons buttons, Point point) { // Pan if (ModifierKeys.HasFlag(Keys.Control) && buttons.HasFlag(MouseButtons.Left)) { AdjustLocations(zedGraphControl.GraphPane); } CurveItem nearestCurveItem = null; var index = -1; if (TryGetNearestCurveItem(point, ref nearestCurveItem, ref index)) { var lineItem = nearestCurveItem as LineItem; if (lineItem == null || index < 0 || index >= lineItem.Points.Count || lineItem[index].Tag == null) { return(false); } _selectedRow = (FoldChangeBindingSource.FoldChangeRow)lineItem[index].Tag; zedGraphControl.Cursor = Cursors.Hand; if (_tip == null) { _tip = new NodeTip(this) { Parent = ParentForm } } ; _tip.SetTipProvider(new FoldChangeRowTipProvider(_selectedRow), new Rectangle(point, new Size()), point); return(true); } else { if (_tip != null) { _tip.HideTip(); } _selectedRow = null; return(false); } }
public PopupPickList(IChildPicker picker, string childHeading, bool okOnDeactivate) { InitializeComponent(); Size = SizeAll; cbItems.Text = childHeading; _modFonts = new ModFontHolder(pickListMulti); _nodeTip = new NodeTip(this) { Parent = this }; _picker = picker; _chosenAtStart = new List <DocNode>(picker.Chosen); _okOnDeactivate = okOnDeactivate; bool filter = tbbFilter.Checked = _picker.Filtered; var choices = picker.GetChoices(filter).ToArray(); if (choices.Length != choices.Select(c => c.Id.GlobalIndex).Distinct().Count()) { throw new ArgumentException("Choices must be unique"); // Not L10N } if (filter) { // If filtered choices do not contain a choice that // has already been chose, then use the unfiltered list. foreach (var choice in _chosenAtStart) { if (!ContainsChoice(choices, choice)) { choices = picker.GetChoices(false).ToArray(); tbbFilter.Checked = false; break; } } } SetChoices(choices, _chosenAtStart); if (pickListMulti.Items.Count > 0) { pickListMulti.SelectedIndex = 0; } // Avoid setting the property, because it will actually // change what is picked. _autoManageChildren = _picker.AutoManageChildren; UpdateAutoManageUI(); // Hide the synchronize checkbox, or set its label correctly string synchLabelText = _picker.SynchSiblingsLabel; if (string.IsNullOrEmpty(synchLabelText)) { cbSynchronize.Visible = false; // Resize to hide space for the checkbox var anchorList = pickListMulti.Anchor; pickListMulti.Anchor = anchorList & ~AnchorStyles.Bottom; Height = pickListMulti.Bottom + 8; pickListMulti.Anchor = anchorList; } else { cbSynchronize.Text = synchLabelText; cbSynchronize.Checked = _picker.IsSynchSiblings; } }
public PopupPickList(IChildPicker picker, string childHeading, bool okOnDeactivate) { InitializeComponent(); Size = SizeAll; cbItems.Text = childHeading; _modFonts = new ModFontHolder(pickListMulti); _nodeTip = new NodeTip(this); _picker = picker; _chosenAtStart = new List<DocNode>(picker.Chosen); _okOnDeactivate = okOnDeactivate; bool filter = tbbFilter.Checked = _picker.Filtered; var choices = picker.GetChoices(filter).ToArray(); if (choices.Length != choices.Select(c => c.Id.GlobalIndex).Distinct().Count()) throw new ArgumentException("Choices must be unique"); // Not L10N if (filter) { // If filtered choices do not contain a choice that // has already been chose, then use the unfiltered list. foreach (var choice in _chosenAtStart) { if (!ContainsChoice(choices, choice)) { choices = picker.GetChoices(false).ToArray(); tbbFilter.Checked = false; break; } } } SetChoices(choices, _chosenAtStart); if (pickListMulti.Items.Count > 0) pickListMulti.SelectedIndex = 0; // Avoid setting the property, because it will actually // change what is picked. _autoManageChildren = _picker.AutoManageChildren; UpdateAutoManageUI(); // Hide the synchronize checkbox, or set its label correctly string synchLabelText = _picker.SynchSiblingsLabel; if (string.IsNullOrEmpty(synchLabelText)) { cbSynchronize.Visible = false; // Resize to hide space for the checkbox var anchorList = pickListMulti.Anchor; pickListMulti.Anchor = anchorList & ~AnchorStyles.Bottom; Height = pickListMulti.Bottom + 8; pickListMulti.Anchor = anchorList; } else { cbSynchronize.Text = synchLabelText; cbSynchronize.Checked = _picker.IsSynchSiblings; } }