• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IVwGraphics类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IVwGraphics的典型用法代码示例。如果您正苦于以下问题:C# IVwGraphics类的具体用法?C# IVwGraphics怎么用?C# IVwGraphics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IVwGraphics类属于命名空间,在下文中一共展示了IVwGraphics类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetRenderer

		public IRenderEngine GetRenderer(int ws, IVwGraphics vg)
		{
			IRenderEngine result;
			if (m_renderers.TryGetValue(ws, out result))
				return result;
			return Renderer;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:7,代码来源:MockRendererFactory.cs


示例2: DrawText

		public void DrawText(int ichBase, IVwGraphics vg, Rect rcSrc, Rect rcDst, out int dxdWidth)
		{
			dxdWidth = Width;
			var args = new SegDrawTextArgs();
			args.ichBase = ichBase;
			args.vg = vg;
			args.rcSrc = rcSrc;
			args.rcDst = rcDst;
			LastDrawTextCall = args;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:10,代码来源:MockSegment.cs


示例3: PaintForeground

		public override void PaintForeground(IVwGraphics vg, PaintTransform ptrans)
		{
			if (Segment == null)
				return;
			int dxdWidth;
			PaintTransform segTrans = ptrans.PaintTransformOffsetBy(Left, Top);

			if (AnyColoredBackground)
				Segment.DrawTextNoBackground(IchMin, vg, segTrans.SourceRect, segTrans.DestRect, out dxdWidth);
			else
				Segment.DrawText(IchMin, vg, segTrans.SourceRect, segTrans.DestRect, out dxdWidth); // more efficient.
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:12,代码来源:StringBox.cs


示例4: FindBreakPoint

		public void FindBreakPoint(IVwGraphics vg, IVwTextSource _ts, IVwJustifier _vjus, int ichMin, int ichLim,
			int ichLimBacktrack, bool fNeedFinalBreak, bool fStartLine, int dxMaxWidth, LgLineBreak lbPref,
			LgLineBreak lbMax, LgTrailingWsHandling twsh, bool fParaRightToLeft,
			out ILgSegment segRet, out int dichLimSeg, out int dxWidth, out LgEndSegmentType est, ILgSegment _segPrev)
		{

			MockSegment seg;
			var key = new MockSegKey(ichMin, ichLim);
			if (lbPref != LgLineBreak.klbClipBreak && m_failOnPartialLine.Contains(key))
			{
				// fail.
				segRet = null;
				dichLimSeg = 0;
				dxWidth = 0;
				est = LgEndSegmentType.kestNothingFit;
				return;
			}
			if (m_potentialSegs.TryGetValue(key, out seg))
			{
				if (seg.Width < dxMaxWidth) // otherwise we meant it for the next line.
				{
					segRet = seg;
					dichLimSeg = seg.get_Lim(ichMin);
					dxWidth = seg.get_Width(ichMin, vg);
					est = seg.EndSegType;
					return;
				}
			}
			switch(OtherSegPolicy)
			{
				case UnexpectedSegments.DontFit:
				default: // to make compiler happy
					Assert.AreNotEqual(LgLineBreak.klbClipBreak, lbMax,
									   "FindBreakPoint called with unexpected arguments.");
					// If we aren't pre-prepared for the requested break, assume nothing fits with these arguments.
					segRet = null;
					dichLimSeg = 0;
					dxWidth = 0;
					est = LgEndSegmentType.kestNothingFit;
					break;
				case UnexpectedSegments.MakeOneCharSeg:
					// Make a very narrow segment that will fit and allow more stuff. This will usually give a test failure if not intentional.
					seg = new MockSegment(1, 2, 1, LgEndSegmentType.kestOkayBreak);
					// If we aren't pre-prepared for the requested break, assume nothing fits with these arguments.
					segRet = seg;
					dichLimSeg = 1;
					dxWidth = 2;
					est = LgEndSegmentType.kestOkayBreak;
					break;
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:51,代码来源:MockRenderEngine.cs


示例5: PaintForeground

			public override void PaintForeground(IVwGraphics vg, PaintTransform ptrans)
			{
				((MockGraphics)vg).DrawActions.Add(this);
			}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:4,代码来源:RowTests.cs


示例6: get_Renderer

		public IRenderEngine get_Renderer(int ws, IVwGraphics _vg)
		{
			return m_engine;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:4,代码来源:DefaultWritingSystemFactory.cs


示例7:

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Inform the container when done with the graphics object.
		/// </summary>
		/// <param name="prootb"></param>
		/// <param name="pvg"></param>
		/// -----------------------------------------------------------------------------------
		void IVwRootSite.ReleaseGraphics(IVwRootBox prootb, IVwGraphics pvg)
		{
			// Do nothing for printing
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:11,代码来源:PrintRootSite.cs


示例8: MakeSelectionAt

		/// <summary>
		/// Make whatever selection is appropriate for the given click. The transformation is the usual one passed to this box,
		/// that is, it transforms where (which is in paint coords) into a point in the same coordinate system as our own top, left.
		/// </summary>
		internal virtual Selections.Selection MakeSelectionAt(Point where, IVwGraphics vg, PaintTransform leafTrans)
		{
			return null;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:8,代码来源:LeafBox.cs


示例9: Location

		public void Location(IVwGraphics _vg, Utils.Rect rcSrc, Utils.Rect rcDst,
			out Utils.Rect _rdPrimary, out Utils.Rect _rdSecondary, out bool _fSplit,
			out bool _fEndBeforeAnchor)
		{
			_rdPrimary = default(Utils.Rect);
			_rdSecondary = default(Utils.Rect);
			_fSplit = false;
			_fEndBeforeAnchor = false;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:9,代码来源:IbusRootSiteEventHandlerTests.cs


示例10: DrawingErrors

		public void DrawingErrors(IVwGraphics _vg)
		{
			throw new NotImplementedException();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:4,代码来源:IbusRootSiteEventHandlerTests.cs


示例11: MakeLayoutInfo

		internal static LayoutInfo MakeLayoutInfo(int maxWidth, IVwGraphics vg, IRendererFactory factory)
		{
			return new LayoutInfo(2, 2, 96, 96, maxWidth, vg, factory);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:4,代码来源:DoubleClickTests.cs


示例12: CallOnTyping

			protected override void CallOnTyping(IVwGraphics vg, string str, int cchBackspace, int cchDelForward, char chFirst, Rectangle rcSrcRoot, Rectangle rcDstRoot)
			{
				base.CallOnTyping(vg, str, cchBackspace, cchDelForward, chFirst, rcSrcRoot, rcDstRoot);
				Cache.EnableUndo = false;	// Things have changed in a way we can't Undo.
			}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:5,代码来源:ReversalIndexEntrySlice.cs


示例13: Paint

		/// <summary>
		/// The root box handles the overall paint.
		/// </summary>
		/// <param name="vg"></param>
		/// <param name="ptrans"></param>
		public void Paint(IVwGraphics vg, PaintTransform ptrans)
		{
			if (m_layoutCallbacks != null)
			{
				// In a state where we can't paint. Arrange for an invalidate AFTER the dangerous operation is over,
				// so what needs painting eventually does get painted.
				var bounds = Bounds;
				bounds.Inflate(10, 10);
				m_layoutCallbacks.Invalidate(bounds);
				return;
			}
			// First we paint the overall background. This basically covers everything but text.
			PaintBackground(vg, ptrans);
			// Then the text.
			PaintForeground(vg, ptrans);
			// And finally the selection.
			if (Selection != null && m_selectionShowing)
			{
				if (Selection.IsValid)
					Selection.Draw(vg, ptrans);
				else
					Selection = null;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:29,代码来源:RootBox.cs


示例14: OnDragDrop

		/// <summary>
		/// Implement dragging to this view.
		/// </summary>
		public void OnDragDrop(DragEventArgs drgevent, Point location, IVwGraphics vg, PaintTransform ptrans)
		{
			var sel = GetSelectionAt(location, vg, ptrans) as InsertionPoint;
			if (sel == null)
				return;
			var rtf = drgevent.Data.GetData(DataFormats.Rtf);
			var data = drgevent.Data.GetData(DataFormats.StringFormat);
			if (data == null)
				return;
			var text = data.ToString(); // MS example of GetData does this, though for DataFormats.Text.

			if (DragState == WindowDragState.InternalMove)
			{
				DragState = WindowDragState.None;
				// We are dragging our own selection. Is it in the same property?
				var range = (RangeSelection)Selection;
				// Enhance JohnT: when we can drag a range that isn't all in one property, this needs more work.
				if (!Selection.IsInsertionPoint)
				{
					if (Selection.Contains(sel))
					{
						Selection = sel;
						return; // Can't drag to inside own selection.
					}
				}
				if (range.End.Hookup == sel.Hookup && range.End.StringPosition < sel.StringPosition)
				{
					// Dragging to later in the same property. If we delete first, we will mess up the insert
					// position. However, a simple solution is to insert first.
					//Log("Inserted dropped " + text + " before deleted range");
					if (rtf == null)
						sel.InsertText(text);
					else if (!sel.InsertRtfString(rtf.ToString()))
						sel.InsertText(text);
					range.Delete();
					return;
				}
				// The bit we're moving comes after the place to insert, or they are in separate properties.
				// We can just go ahead and delete the source first, since we already have a copy of the
				// text to insert.
				// Enhance JohnT: do we need to consider a special case where the source and destination are
				// different occurrences of the same property?
				//Log("Deleted selection");
				range.Delete();
			}
			DragState = WindowDragState.None;

			//Log("Dropped text: " + text);
			if (rtf == null)
				sel.InsertText(text);
			else if (!sel.InsertRtfString(rtf.ToString()))
				sel.InsertText(text);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:56,代码来源:RootBox.cs


示例15: OnDragEnter

		/// <summary>
		/// Returns information about possible drops with these arguments.
		/// </summary>
		public void OnDragEnter(DragEventArgs drgevent, Point location, IVwGraphics vg, PaintTransform ptrans)
		{
			if (DragState == WindowDragState.InternalMove)
			{
				// On a simple click (at least), Windows calls OnDragEnter AFTER OnQueryContinueDrag, attempting to drop
				// right where we clicked. OnQueryContinueDrag detects this; we must not reset it.
				return;
			}
			drgevent.Effect = DragDropEffects.None; // default
			var sel = GetSelectionAt(location, vg, ptrans) as InsertionPoint;
			if (sel == null)
				return;
			if (!sel.CanInsertText)
				return;
			var data = drgevent.Data.GetData(DataFormats.StringFormat);
			if (data == null)
				return;

			DragState = WindowDragState.DraggingHere;

			// We will copy if control is held down or move is not allowed.)
			if ((drgevent.KeyState & (int)DragDropKeyStates.ControlKey) != 0 ||
				(drgevent.AllowedEffect & DragDropEffects.Move) == 0)
			{
				//Log("DragEnter/Move: set effect to copy");
				drgevent.Effect = DragDropEffects.Copy;
			}
			else
			{
				//Log("DragEnter/Move: set effect to move");
				drgevent.Effect = DragDropEffects.Move;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:36,代码来源:RootBox.cs


示例16: DrawRoot

		public void DrawRoot(IVwGraphics _vg, Utils.Rect rcSrc, Utils.Rect rcDst, bool fDrawSel)
		{
			throw new NotImplementedException();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:4,代码来源:IbusRootSiteEventHandlerTests.cs


示例17: Layout

		public void Layout(IVwGraphics _vg, int dxsAvailWidth)
		{
			throw new NotImplementedException();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:4,代码来源:IbusRootSiteEventHandlerTests.cs


示例18: AddDependentObjectsToPageRoot

		/// -------------------------------------------------------------------------------------
		/// <summary>
		/// The layout manager is informed by this method that the (primary) layout stream 'lay'
		/// has determined that references to the objects objectGuids occur on the page. The input
		/// value of dysAvailHeight indicates how much of the height allocated to 'lay' for this
		/// page will remain available if the text containing these references is added to the
		/// page (assuming that adding them does not reduce the space available for 'lay').
		/// This is an alternative implementation of AddDependentObjects for the case where
		/// RootOnEachPage is true.
		/// </summary>
		/// <param name="lay">The primary layout stream filling the page</param>
		/// <param name="vg">The graphics object being used to layout the page</param>
		/// <param name="hPage">The handle to the page being laid out</param>
		/// <param name="cguid">Number of elements in objectGuids array</param>
		/// <param name="objectGuids">Array of GUIDS representing objects to be laid out in a
		/// separate layout stream</param>
		/// <param name="fAllowFail">Indicates whether this method can fail (return
		/// <c>fFailed == true</c>). If this is false, this method should force the requested
		/// objects to be laid out within the available space, even if it requires omitting or
		/// truncating some or all of them</param>
		/// <param name="fFailed">If the available height would become negative (typically
		/// because the objects must share space with 'lay' and they don't fit in the available
		/// height), this will be set to true (unless fAllowFail is false).</param>
		/// <param name="dysAvailHeight">Input value indicates how much of the height allocated
		/// to 'lay' for this page will remain available if the text containing these references
		/// is added to the page, assuming that adding them does not reduce the space available
		/// for 'lay'. The output value indicates how much is left after laying out these
		/// dependent objects.</param>
		/// -------------------------------------------------------------------------------------
		public virtual void AddDependentObjectsToPageRoot(IVwLayoutStream lay, IVwGraphics vg,
			int hPage, int cguid, Guid[] objectGuids, bool fAllowFail, out bool fFailed,
			ref int dysAvailHeight)
		{
			int dysAvailableHeight = dysAvailHeight;
			fFailed = false;

			int[] rgHvo = new int[cguid];
			int i = 0;
			foreach (Guid guid in objectGuids)
			{
				int hvo = m_configurer.GetIdFromGuid(guid);
				if (hvo != 0)
					rgHvo[i++] = hvo; // only add the ones we can match.
				else
					cguid--; // found unmatched guid
			}
			Page page = Publication.FindPage(hPage);
			if (page.DoingTrialLayout)
			{
				page.NoteDependentRoots(rgHvo);
				// note that we do not need to adjust dysAvailHeight, because in trial mode the
				// INITIAL height is set to the space available minus the old dependent root
				// objects view's height.
				return;
			}

			// Collect some information we need
			IVwLayoutStream dependentStream = page.DependentObjectsRootStream;
			IVwRootBox dependentRootbox = (IVwRootBox)dependentStream;
			int hvoRoot = m_configurer.DependentRootHvo;
			int dependentObjTag = m_configurer.DependentRootTag;
			int dependentObjFrag = m_configurer.DependentRootFrag;
			IDependentObjectsVc depObjVc;
			ISilDataAccess sda = m_configurer.DataAccess;
			int oldHeight = 0;
			int startIndex = -1;
			int endIndex = -1;
			int prevStartIndex;
			int prevEndIndex;
			if (dependentRootbox == null)
			{
				// no pre-existing rootbox for this page so create a new one
				depObjVc = m_configurer.DependentRootVc;
				dependentStream = VwLayoutStreamClass.Create();
				dependentStream.SetManager(this);
				page.DependentObjectsRootStream = dependentStream;
				dependentRootbox = (IVwRootBox)dependentStream;
				dependentRootbox.SetSite(Publication);
				dependentRootbox.DataAccess = sda;
				dependentRootbox.SetRootObject(hvoRoot, depObjVc, dependentObjFrag, m_configurer.StyleSheet);
				// Set up the view constructor to show the correct objects
				if (cguid > 0)
				{
					startIndex = sda.GetObjIndex(hvoRoot, dependentObjTag, rgHvo[0]);
					endIndex = sda.GetObjIndex(hvoRoot, dependentObjTag, rgHvo[cguid - 1]);
					Debug.Assert(startIndex >= 0 && endIndex >= 0);
				}
				depObjVc.StartingObjIndex = startIndex;
				depObjVc.EndingObjIndex = endIndex;
				prevStartIndex = prevEndIndex = -1;
			}
			else
			{
				// A rootbox was already created for this page, just update what is shown
				oldHeight = dependentRootbox.Height;
				IVwViewConstructor vc;
				IVwStylesheet ss;
				dependentRootbox.GetRootObject(out hvoRoot, out vc, out dependentObjFrag, out ss);
				depObjVc = (IDependentObjectsVc)vc;

//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:DivisionLayoutMgr.cs


示例19: DrawRoot2

		public void DrawRoot2(IVwGraphics _vg, Utils.Rect rcSrc, Utils.Rect rcDst, bool fDrawSel,
			int ysTop, int dysHeight)
		{
			throw new NotImplementedException();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:5,代码来源:IbusRootSiteEventHandlerTests.cs


示例20: AddDependentObjects

		/// -------------------------------------------------------------------------------------
		/// <summary>
		/// The layout manager is informed by this method that the (primary) layout stream 'lay'
		/// has determined that references to the objects objectGuids occur on the page. The input
		/// value of dysAvailHeight indicates how much of the height allocated to 'lay' for this
		/// page will remain available if the text containing these references is added to the
		/// page (assuming that adding them does not reduce the space available for 'lay').
		/// </summary>
		/// <param name="lay">The primary layout stream filling the page</param>
		/// <param name="vg">The graphics object being used to layout the page</param>
		/// <param name="hPage">The handle to the page being laid out</param>
		/// <param name="cguid">Number of elements in objectGuids array</param>
		/// <param name="objectGuids">Array of GUIDS representing objects to be laid out in a
		/// separate layout stream</param>
		/// <param name="fAllowFail">Indicates whether this method can fail (return
		/// <c>fFailed == true</c>). If this is false, this method should force the requested
		/// objects to be laid out within the available space, even if it requires omitting or
		/// truncating some or all of them</param>
		/// <param name="fFailed">If the available height would become negative (typically
		/// because the objects must share space with 'lay' and they don't fit in the available
		/// height), this will be set to true (unless fAllowFail is false).</param>
		/// <param name="dysAvailHeight">Input value indicates how much of the height allocated
		/// to 'lay' for this page will remain available if the text containing these references
		/// is added to the page, assuming that adding them does not reduce the space available
		/// for 'lay'. The output value indicates how much is left after laying out these
		/// dependent objects.</param>
		/// -------------------------------------------------------------------------------------
		public virtual void AddDependentObjects(IVwLayoutStream lay, IVwGraphics vg, int hPage,
			int cguid, Guid[] objectGuids, bool fAllowFail, out bool fFailed,
			ref int dysAvailHeight)
		{
			CheckDisposed();
			if (m_configurer.RootOnEachPage)
			{
				AddDependentObjectsToPageRoot(lay, vg, hPage,
					cguid, objectGuids, fAllowFail, out fFailed,
					ref dysAvailHeight);
				return;
			}

			int dysAvailableHeight = dysAvailHeight;
			fFailed = false;

			int[] rgHvo = new int[cguid];
			int i = 0;
			foreach (Guid guid in objectGuids)
			{
				rgHvo[i++] = m_configurer.GetIdFromGuid(guid);
			}

			// Attempt to add all objects to any stream(s) that care about them. Don't
			// commit changes to any streams until we see if everything will fit.
			int[] rgdysNewStreamHeight = new int[m_subStreams.Count];
			int iSubStream = -1;
			foreach (SubordinateStream subStream in m_subStreams)
			{
				subStream.m_stream.SetManager(this); // Set this every time for the sake of shared streams
				iSubStream++;
				int dysInitialPageHeight = subStream.m_stream.PageHeight(hPage);
				foreach (int hvo in rgHvo)
				{
					if (hvo == 0)
						continue; // Unable to find object in database. (TE-5007)
					SelLevInfo[] rgSelLevInfo = subStream.m_delegate.GetPathToObject(hvo);
					if (rgSelLevInfo == null)
						continue; // This stream doesn't display this object.

					subStream.m_stream.LayoutObj(vg, AvailablePageWidthInPrinterPixels, 0,
						rgSelLevInfo.Length, rgSelLevInfo, hPage);
				}
				int dysHeightWithAddedObjects = subStream.m_stream.PageHeight(hPage);
				rgdysNewStreamHeight[iSubStream] = dysHeightWithAddedObjects;

				int dysHeightUsed = dysHeightWithAddedObjects - dysInitialPageHeight;
				// If this stream is just now being added to the page, need to allow for gap between elements.
				if (dysInitialPageHeight == 0)
					dysHeightUsed += VerticalGapBetweenElements * vg.YUnitsPerInch / MiscUtils.kdzmpInch;

				if ((dysHeightUsed * m_numberMainStreamColumns) > dysAvailHeight)
				{
					// We can't add everything needed for the current chunk (in the main stream),
					// so we need to fail (if that's permitted), and roll everything back
					if (fAllowFail)
						fFailed = true;
					else
						dysAvailableHeight = 0;
					break;
				}
				else
				{
					// When we layout with multiple columns, we pretend to have one large
					// page. But the substreams are still only one column which means
					// they affect all columns, so we have to multiply the height used
					// with the number of columns.
					dysAvailableHeight -= (dysHeightUsed * m_numberMainStreamColumns);
				}
			}

			// Now we know all the objects fit (or else we weren't allowed to fail), so
			// remove or commit the objects we just added to any streams AND adjust
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:DivisionLayoutMgr.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IVwRootBox类代码示例发布时间:2022-05-24
下一篇:
C# IVwEnv类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap