本文整理汇总了C#中IVsTextLines.GetStateFlags方法的典型用法代码示例。如果您正苦于以下问题:C# IVsTextLines.GetStateFlags方法的具体用法?C# IVsTextLines.GetStateFlags怎么用?C# IVsTextLines.GetStateFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsTextLines
的用法示例。
在下文中一共展示了IVsTextLines.GetStateFlags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConsoleWindow
/// <summary>
/// Creates a new ConsoleWindow object.
/// This constructor uses the service provider passed as an argument to create and initialize
/// the text buffer.
/// </summary>
public ConsoleWindow(IServiceProvider provider)
: base(null)
{
if (null == provider)
throw new ArgumentNullException("provider");
globalProvider = provider;
// Create the text buffer.
textLines = (IVsTextLines)CreateObject(typeof(VsTextBufferClass), typeof(IVsTextLines));
// Get a reference to the global service provider.
IOleServiceProvider nativeProvider = (IOleServiceProvider)globalProvider.GetService(typeof(IOleServiceProvider));
// The text buffer must be sited with the global service provider.
((IObjectWithSite)textLines).SetSite(nativeProvider);
// Set the buffer as read-only. The user should be able to change the content of the
// buffer only if the engine is started.
uint flags;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(
textLines.GetStateFlags(out flags));
flags |= (uint)Microsoft.VisualStudio.TextManager.Interop.BUFFERSTATEFLAGS.BSF_USER_READONLY;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(
textLines.SetStateFlags(flags));
// Set the GUID of the language service that will handle this text buffer
Guid languageGuid = typeof(PythonLanguage).GUID;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(
textLines.SetLanguageServiceID(ref languageGuid));
// Initialize the history
history = new HistoryBuffer();
// Create the stream on top of the text buffer.
textStream = new TextBufferStream(textLines);
// Initialize the engine.
InitializeEngine();
// Set the title of the window.
this.Caption = Resources.ToolWindowTitle;
// Set the icon of the toolwindow.
this.BitmapResourceID = 301;
this.BitmapIndex = 0;
}