当前位置: 首页>>代码示例>>C#>>正文


C# SelectionHelper.SetIhvoRoot方法代码示例

本文整理汇总了C#中SIL.FieldWorks.Common.RootSites.SelectionHelper.SetIhvoRoot方法的典型用法代码示例。如果您正苦于以下问题:C# SelectionHelper.SetIhvoRoot方法的具体用法?C# SelectionHelper.SetIhvoRoot怎么用?C# SelectionHelper.SetIhvoRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SIL.FieldWorks.Common.RootSites.SelectionHelper的用法示例。


在下文中一共展示了SelectionHelper.SetIhvoRoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetInsertionPoint

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Navigate to the beginning of any Scripture element: Title, Section Head, or Section
		/// Content.
		/// </summary>
		/// <param name="tag">Indicates whether selection should be made in the title, section
		/// Heading or section Content</param>
		/// <param name="book">The 0-based index of the Scripture book in which to put the
		/// insertion point</param>
		/// <param name="section">The 0-based index of the Scripture section in which to put the
		/// insertion point. Ignored if tag is <see cref="ScrBook.ScrBookTags.kflidTitle"/></param>
		/// <param name="paragraph">The 0-based index of the paragraph which to put the
		/// insertion point.</param>
		/// <param name="character">index of character where insertion point will be set</param>
		/// <param name="fAssocPrev">True if the properties of the text entered at the new
		/// insertion point should be associated with the properties of the text before the new
		/// insertion point. False if text entered at the new insertion point should be
		/// associated with the text following the new insertion point.</param>
		/// <returns>True if it succeeded, false otherwise</returns>
		/// ------------------------------------------------------------------------------------
		public bool SetInsertionPoint(int tag, int book, int section, int paragraph, int character,
			bool fAssocPrev)
		{
			CheckDisposed();

			SelectionHelper selHelper = new SelectionHelper(); //SelectionHelper.Create(Callbacks.EditedRootBox.Site);// new SelectionHelper();
			int cLev;
			if (tag == (int)ScrBook.ScrBookTags.kflidTitle)
			{
				cLev = kBookTitleLevelCount;
				selHelper.NumberOfLevels = cLev;
				selHelper.LevelInfo[cLev - 1].tag = tag;
			}
			else
			{
				cLev = kSectionLevelCount;
				selHelper.NumberOfLevels = cLev;
				selHelper.LevelInfo[cLev - 1].tag = (int)ScrBook.ScrBookTags.kflidSections;
				selHelper.LevelInfo[cLev - 1].ihvo = section;
				selHelper.LevelInfo[cLev - 2].tag = tag;
			}
			selHelper.LevelInfo[0].ihvo = paragraph;
			selHelper.AssocPrev = fAssocPrev;

			// Prepare to move the IP to the specified character in the paragraph.
			selHelper.IchAnchor = character;
			selHelper.IchEnd = character;

			selHelper.SetIhvoRoot(SelectionHelper.SelLimitType.Anchor, book);
			selHelper.SetIhvoRoot(SelectionHelper.SelLimitType.End, book);

			// Now that all the preparation to set the IP is done, set it.
			IVwSelection vwsel = selHelper.SetSelection(this, true, true);

			// Now set the scroll position where the IP will be centered vertically.
			AutoScrollPosition = new Point(-AutoScrollPosition.X,
				-(AutoScrollPosition.Y - IPDistanceFromWindowTop(vwsel) + Height / 2));

			// If the selection is still not visible (which should only be the case if
			// we're at the end of the view), just take whatever MakeSelectionVisible()
			// gives us.
			if (!IsSelectionVisible(vwsel))
				ScrollSelectionIntoView(vwsel, VwScrollSelOpts.kssoDefault);

			if (vwsel == null)
				Debug.WriteLine("SetSelection failed in DiffView.SetInsertionPoint()");
			return (vwsel != null);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:68,代码来源:DiffView.cs


注:本文中的SIL.FieldWorks.Common.RootSites.SelectionHelper.SetIhvoRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。