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


C# IVsTextView.SetTopLine方法代码示例

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


在下文中一共展示了IVsTextView.SetTopLine方法的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: FocusLine

        internal static void FocusLine(IVsTextView viewAdapter, int line, int col) {
            ErrorHandler.ThrowOnFailure(viewAdapter.SetCaretPos(line, col));
            // Make sure that the text is visible.
            int topline = line - 10;
            if(topline < 0)
                topline = 0;

            viewAdapter.SetTopLine(topline);
            viewAdapter.CenterLines(line, 1);

        }
开发者ID:X-Sharp,项目名称:XSharpPublic,代码行数:11,代码来源:VSShellUtilities.cs

示例3: 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

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