internal Rectangle LocationOfSelectedRow() { IVwSelection sel = GetRowSelection(m_selectedIndex); using (HoldGraphics hg = new HoldGraphics(this)) { Rect rcPrimary; Rect rcSecondary; bool fSplit; Rectangle rcSrcRoot; Rectangle rcDstRoot; GetCoordRects(out rcSrcRoot, out rcDstRoot); bool fEndBeforeAnchor; sel.Location(m_graphicsManager.VwGraphics, rcSrcRoot, rcDstRoot, out rcPrimary, out rcSecondary, out fSplit, out fEndBeforeAnchor); return new Rectangle(rcPrimary.left, rcPrimary.top, rcPrimary.right - rcPrimary.left, rcPrimary.bottom - rcPrimary.top); } }
/// <summary> /// Override to provide default handling of Context manu key. /// </summary> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.Apps || keyData == (Keys.F10 | Keys.Shift)) { if (RootBox != null && RootBox.Selection != null) { Point pt; // Set point to somewhere around the middle of the selection in window coords. using (new HoldGraphics(this)) { Rectangle rcSrcRoot, rcDstRoot; Rect rcSec, rcPrimary; bool fSplit, fEndBeforeAnchor; GetCoordRects(out rcSrcRoot, out rcDstRoot); RootBox.Selection.Location(m_graphicsManager.VwGraphics, rcSrcRoot, rcDstRoot, out rcPrimary, out rcSec, out fSplit, out fEndBeforeAnchor); pt = new Point((rcPrimary.right + rcPrimary.left)/2, (rcPrimary.top + rcPrimary.bottom)/2); } if (HandleContextMenuFromKeyboard(RootBox.Selection, pt)) return true; // These two checks are copied from OnRightMouseUp; not sure why (or whether) they are needed. if (DataUpdateMonitor.IsUpdateInProgress()) return true; //discard this event if (IsFollowLinkMsgPending) { return true; //discard this event } using (var hg = new HoldGraphics(this)) { Rectangle rcSrcRoot, rcDstRoot; GetCoordRects(out rcSrcRoot, out rcDstRoot); return DoContextMenu(RootBox.Selection, pt, rcSrcRoot, rcDstRoot); } } return true; } return base.ProcessCmdKey(ref msg, keyData); }