本文整理匯總了C#中System.Windows.Forms.Document.Object方法的典型用法代碼示例。如果您正苦於以下問題:C# Document.Object方法的具體用法?C# Document.Object怎麽用?C# Document.Object使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.Object方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: getDocumentText
private string getDocumentText(Document document)
{
if (document == null) return null;
var textDocument = (TextDocument)document.Object("TextDocument");
EditPoint editPoint = textDocument.StartPoint.CreateEditPoint();
var content = editPoint.GetText(textDocument.EndPoint);
return content;
}
示例2: GetTextDocument
private TextDocument GetTextDocument(Document doc) {
if (doc == null || doc.ReadOnly) {
return null;
}
var textDoc = doc.Object("TextDocument") as TextDocument;
return textDoc;
}
示例3: DocumentReader
public DocumentReader(Document document)
{
this.document = document;
TextDocument textDocument = (TextDocument)document.Object("TextDocument");
EditPoint editPoint = textDocument.StartPoint.CreateEditPoint();
editPoint.StartOfDocument();
strDocument = editPoint.GetText(textDocument.EndPoint);
documentIndex = -1;
SetTabSize();
}
示例4: InsertTemplate
private void InsertTemplate(Document document, string toInsert)
{
var textDocument = document.Object() as TextDocument;
textDocument.StartPoint.CreateEditPoint();
textDocument.Selection.Insert(toInsert);
}
示例5: SelectAllCodeFromDocument
//Nice clean methods avoiding slow selection-editing, from online post at:
// http://www.visualstudiodev.com/visual-studio-extensibility/how-can-i-edit-documents-programatically-22319.shtml
private static string SelectAllCodeFromDocument(Document targetDoc)
{
string outText = "";
TextDocument textDoc = targetDoc.Object("TextDocument") as TextDocument;
if (textDoc != null)
outText = textDoc.StartPoint.CreateEditPoint().GetText(textDoc.EndPoint);
return outText;
}
示例6: ReplaceAllCodeInDocument
private static void ReplaceAllCodeInDocument(Document targetDoc, string newText)
{
TextDocument textDoc = targetDoc.Object("TextDocument") as TextDocument;
if (textDoc != null)
{
textDoc.StartPoint.CreateEditPoint().Delete(textDoc.EndPoint);
textDoc.StartPoint.CreateEditPoint().Insert(newText);
}
}
示例7: ReplaceAllCodeInDocument
private static void ReplaceAllCodeInDocument(Document targetDoc, string newText)
{
TextDocument textDoc = targetDoc.Object("TextDocument") as TextDocument;
if (textDoc != null)
{
textDoc.StartPoint.CreateEditPoint().ReplaceText(textDoc.EndPoint, newText, (int)vsEPReplaceTextOptions.vsEPReplaceTextKeepMarkers);
}
}
示例8: GetTextDocument
public static TextDocument GetTextDocument(Document doc)
{
return doc.Object("TextDocument") as TextDocument;
}