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


C# IVsTextView.GetLineHeight方法代码示例

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


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

示例1: ScrollToEnd

 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.ScrollToEnd2"]/*' />
 public void ScrollToEnd(IVsTextView view) {
     IVsTextLines buffer;
     NativeMethods.ThrowOnFailure(view.GetBuffer(out buffer));
     int lines;
     NativeMethods.ThrowOnFailure(buffer.GetLineCount(out lines));
     int lineHeight;
     NativeMethods.ThrowOnFailure(view.GetLineHeight(out lineHeight));
     Microsoft.VisualStudio.NativeMethods.RECT bounds = new Microsoft.VisualStudio.NativeMethods.RECT();
     NativeMethods.GetClientRect(view.GetWindowHandle(), ref bounds);
     int visibleLines = ((bounds.bottom - bounds.top) / lineHeight) - 1;
     int top = Math.Max(0, lines - visibleLines + 4);
     NativeMethods.ThrowOnFailure(view.SetTopLine(top));
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:14,代码来源:LanguageService.cs

示例2: ScrollToEnd

        internal void ScrollToEnd(IVsTextView view)
        {
            IVsTextLines buffer;
            NativeMethods.ThrowOnFailure(view.GetBuffer(out buffer));
            int lines;
            NativeMethods.ThrowOnFailure(buffer.GetLineCount(out lines));
            int lineHeight;
            NativeMethods.ThrowOnFailure(view.GetLineHeight(out lineHeight));
            NativeMethods.RECT bounds = new NativeMethods.RECT();
            NativeMethods.GetClientRect(view.GetWindowHandle(), ref bounds);
            int visibleLines = ((bounds.bottom - bounds.top) / lineHeight) - 1;
            // The line number needed to be passed to SetTopLine is ZERO based, so need to subtract ONE from number of total lines
            int top = Math.Max(0, lines - visibleLines - 1);
            Debug.Assert(lines > top, "Cannot set top line to be greater than total number of lines");
#if XMLTRACE
            Trace.WriteLine("ScrollToEnd: lines=" + lines + ", visibleLines=" + visibleLines + ", top=" + top);
#endif
            NativeMethods.ThrowOnFailure(view.SetTopLine(top));
        }
开发者ID:xenocons,项目名称:visualfsharp,代码行数:19,代码来源:LanguageService.cs

示例3: ShowHint

        public bool ShowHint(IVsTextView view, TextSpan hintSpan, Func<string, string> getHintContent, string hintText)
        {
            if (ContextMenuActive)
                return false;

            var hWnd = view.GetWindowHandle();

            int lineHeight;
              ErrorHelper.ThrowOnFailure(view.GetLineHeight(out lineHeight));

            var ptStart = new Microsoft.VisualStudio.OLE.Interop.POINT[1];
            var ptEnd   = new Microsoft.VisualStudio.OLE.Interop.POINT[1];
            ErrorHelper.ThrowOnFailure(view.GetPointOfLineColumn(hintSpan.iStartLine, hintSpan.iStartIndex, ptStart));
            ErrorHelper.ThrowOnFailure(view.GetPointOfLineColumn(hintSpan.iEndLine, hintSpan.iEndIndex, ptEnd));

              NemerleNativeMethods.ClientToScreen(hWnd, ref ptStart[0]);
              NemerleNativeMethods.ClientToScreen(hWnd, ref ptEnd[0]);

              var hintXml = "<hint>" + hintText.Replace("<unknown>", "&lt;unknown&gt;").Replace("\r", "")
            .Replace("\n", "<lb/>") + "</hint>";

              var rect = new Rect(new Point(ptStart[0].x, ptStart[0].y), new Point(ptEnd[0].x, ptEnd[0].y + lineHeight));

              if (Hint.IsOpen)
              {
            if (Hint.PlacementRect == rect)
            {
              Hint.Text = hintXml;
            return true;
            }

            Hint.Close();
              }

              Hint.Show(hWnd, rect, getHintContent, hintXml);

            return true;
        }
开发者ID:vestild,项目名称:nemerle,代码行数:38,代码来源:NemerleLanguageService.cs

示例4: ScrollToEnd

        /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.ScrollToEnd2"]/*' />
        public void ScrollToEnd(IVsTextView view)
        {
            IVsTextLines buffer;
            NativeMethods.ThrowOnFailure(view.GetBuffer(out buffer));
            int lines;
            NativeMethods.ThrowOnFailure(buffer.GetLineCount(out lines));
            int lineHeight;
            NativeMethods.ThrowOnFailure(view.GetLineHeight(out lineHeight));
            Microsoft.VisualStudio.NativeMethods.RECT bounds = new Microsoft.VisualStudio.NativeMethods.RECT();
            NativeMethods.GetClientRect(view.GetWindowHandle(), ref bounds);
            int visibleLines = ((bounds.bottom - bounds.top) / lineHeight) - 1;
            // If the view hasn't been shown yet, the bounds will be empty, yielding -1 for visibleLinse.
            if (visibleLines < 0) {
                visibleLines = 0;
            }

            // The line number needed to be passed to SetTopLine is ZERO based, so need to subtract ONE from number of total lines
            int top = Math.Max(0, lines - visibleLines - 1);
            Debug.Assert(lines > top, "Cannot set top line to be greater than total number of lines");
            NativeMethods.ThrowOnFailure(view.SetTopLine(top));
        }
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:22,代码来源:LanguageService.cs


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