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


C# ITsTextProps.GetBldr方法代码示例

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


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

示例1: AddTextToPara

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add the given text and props as a new run to the end of the specified paragraph
		/// under construction.
		/// </summary>
		/// <param name="sText">Text to be appended to the paragraph being built</param>
		/// <param name="pttpProps">Properties (should contain only a named style) for the run
		/// of text to be added.</param>
		/// <param name="strbldr">String builder of paragraph being built</param>
		/// ------------------------------------------------------------------------------------
		protected void AddTextToPara(string sText, ITsTextProps pttpProps, ITsStrBldr strbldr)
		{
			// Don't bother trying to add empty runs. Also don't add runs consisting of a single
			// space if processing a marker that maps to a paragraph style.
			if (sText.Length > 0 &&
				(sText != " " || m_styleProxy.StyleType == StyleType.kstCharacter))
			{
				// send the text and props directly to the Builder, after first ensuring that
				// a ws is specified.
				int var;
				int ws = pttpProps.GetIntPropValues((int)FwTextPropType.ktptWs,
					out var);
				if (ws == -1)
				{
					ws = GetWsForContext(strbldr);
					ITsPropsBldr tpb = pttpProps.GetBldr();
					tpb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, ws);
					pttpProps = tpb.GetTextProps();
				}
				int cchLength = strbldr.Length;
				// Remove extra space.
				if (cchLength > 0 && UnicodeCharProps.get_IsSeparator(sText[0]))
				{
					string s = strbldr.GetChars(cchLength - 1, cchLength);
					if (UnicodeCharProps.get_IsSeparator(s[0]))
						sText = sText.Substring(1);
				}

				if (sText != string.Empty || cchLength == 0)
					strbldr.Replace(cchLength, cchLength, sText, pttpProps);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:42,代码来源:TeImport.cs

示例2: UpdateRootBoxTextProps

		public override ITsTextProps UpdateRootBoxTextProps(ITsTextProps ttp)
		{
			ITsPropsBldr propsBldr = ttp.GetBldr();
			propsBldr.SetIntPropValues((int)FwTextPropType.ktptBackColor, (int)FwTextPropVar.ktpvDefault,
				(int)RGB(m_innerTextBox.BackColor));

			using (Graphics graphics = m_innerTextBox.CreateGraphics())
			{
				propsBldr.SetIntPropValues((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint,
					m_innerTextBox.Padding.Top * 72000 / (int)graphics.DpiY);
				propsBldr.SetIntPropValues((int)FwTextPropType.ktptPadBottom, (int)FwTextPropVar.ktpvMilliPoint,
					m_innerTextBox.Padding.Bottom * 72000 / (int)graphics.DpiY);
				propsBldr.SetIntPropValues((int)FwTextPropType.ktptPadLeading, (int)FwTextPropVar.ktpvMilliPoint,
					(m_rtl ? m_innerTextBox.Padding.Right : m_innerTextBox.Padding.Left) * 72000 / (int)graphics.DpiX);
				propsBldr.SetIntPropValues((int)FwTextPropType.ktptPadTrailing, (int)FwTextPropVar.ktpvMilliPoint,
					(m_rtl ? m_innerTextBox.Padding.Left : m_innerTextBox.Padding.Right) * 72000 / (int)graphics.DpiX);
			}

			return propsBldr.GetTextProps();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:20,代码来源:FwTextBox.cs

示例3: AppendRun

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Appends a run of text with the given TsTextProps.
		/// </summary>
		/// <param name="sRun">The text to append</param>
		/// <param name="props">The properties to use</param>
		/// ------------------------------------------------------------------------------------
		public void AppendRun(string sRun, ITsTextProps props)
		{
			CheckDisposed();
			//note: For efficiency, we usually skip the Replace() if the string is empty.
			// However, if the builder is has Length == 0, then we want to replace the
			// properties on the empty run of the TsString.
			// A TsString always has at least one run, even if it is empty, and this controls
			// the props when the user begins to enter text in an empty para.
			if (sRun != string.Empty || Length == 0)
			{
				System.Diagnostics.Debug.Assert(props != null);
				int var;
				int ws = props.GetIntPropValues((int)FwTextPropType.ktptWs, out var);

				// Make sure we handle the magic writing systems
				if (ws == (int)CellarModuleDefns.kwsAnal)
				{
					// default analysis writing system
					ITsPropsBldr bldr = props.GetBldr();
					bldr.SetIntPropValues((int)FwTextPropType.ktptWs, 0,
						m_cache.DefaultAnalWs);
					props = bldr.GetTextProps();
				}
				else if (ws == (int)CellarModuleDefns.kwsVern)
				{
					// default vernacular writing system
					ITsPropsBldr bldr = props.GetBldr();
					bldr.SetIntPropValues((int)FwTextPropType.ktptWs, 0,
						m_cache.DefaultVernWs);
					props = bldr.GetTextProps();
				}
				else
				{
					System.Diagnostics.Debug.Assert(ws > 0);	// not quite right if >2G objects.
				}
				m_ParaStrBldr.Replace(Length, Length, sRun, props);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:45,代码来源:StTxtParaBldr.cs

示例4: UpdateORCforNewObjData

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// In a string builder, updates the given ORC (Object Replacement Character) run
		/// with new object data.
		/// </summary>
		/// <param name="bldr">tss builder holding the ORC run</param>
		/// <param name="ttp">text properties of the ORC run</param>
		/// <param name="tri">The info for the ORC run, including min/lim character indices.</param>
		/// <param name="odt">object data type indicating to which type of object ORC points</param>
		/// <param name="guidOfNewObj">The GUID of new object, to update the ORC</param>
		/// ------------------------------------------------------------------------------------
		private static void UpdateORCforNewObjData(ITsStrBldr bldr, ITsTextProps ttp,
			TsRunInfo tri, FwObjDataTypes odt, Guid guidOfNewObj)
		{
			// build new ObjData properties of the ORC for the new object
			byte[] objData = MiscUtils.GetObjData(guidOfNewObj, (byte)odt);
			ITsPropsBldr propsBldr = ttp.GetBldr();
			propsBldr.SetStrPropValueRgch((int)FwTextPropType.ktptObjData,
				objData, objData.Length);

			// update the run props in the string builder
			bldr.SetProperties(tri.ichMin, tri.ichLim, propsBldr.GetTextProps());
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:23,代码来源:StTxtPara.cs


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