GetCoordRects() protected method

Construct coord transformation rectangles. Height and width are dots per inch. src origin is 0, dest origin is controlled by scrolling.
protected GetCoordRects ( Rectangle &rcSrcRoot, Rectangle &rcDstRoot ) : void
rcSrcRoot System.Drawing.Rectangle
rcDstRoot System.Drawing.Rectangle
return void
Ejemplo n.º 1
0
		private IVwSelection m_sel;		// the selection.
		#endregion

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Construct and save info about selection at top left of rootSite.
		/// </summary>
		/// <param name="rootSite">rootSite</param>
		/// ------------------------------------------------------------------------------------
		public SelPositionInfo(SimpleRootSite rootSite)
		{
			m_rootSite = rootSite;
			if (rootSite == null)
				return;

			int xdLeft = m_rootSite.ClientRectangle.X;
			int ydTop = m_rootSite.ClientRectangle.Y;

			Rectangle rcSrcRoot, rcDstRoot;
			m_rootSite.GetCoordRects(out rcSrcRoot, out rcDstRoot);
			m_sel = m_rootSite.RootBox.MakeSelAt(xdLeft + 1,ydTop + 1, rcSrcRoot, rcDstRoot, false);
			if (m_sel != null)
			{
				bool fEndBeforeAnchor;
				m_rootSite.SelectionRectangle(m_sel, out m_rcPrimaryOld, out fEndBeforeAnchor);
			}
		}
Ejemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="SelectionRestorer"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public SelectionRestorer(SimpleRootSite rootSite)
		{
			// we can't use EditingHelper.CurrentSelection here because the scroll position
			// of the selection may have changed.
			m_savedSelection = SelectionHelper.Create(rootSite);
			m_rootSite = rootSite;

			Rectangle rcSrc, rcDst;
			rootSite.GetCoordRects(out rcSrc, out rcDst);
			try
			{
				IVwSelection sel = rootSite.RootBox.MakeSelAt(5, 5, rcSrc, rcDst, false);
				m_topOfViewSelection = SelectionHelper.Create(sel, rootSite);
			}
			catch (COMException)
			{
				// Just ignore any errors
			}
		}