本文整理汇总了C#中System.Windows.Forms.Document.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Document.Load方法的具体用法?C# Document.Load怎么用?C# Document.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.Load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnOK_Click
private void btnOK_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.txtProjectFile.Text))
{
if (!string.IsNullOrEmpty(DBGlobalService.ProjectFile))
{
DBGlobalService.Save();
}
DBGlobalService.ProjectFile = this.txtProjectFile.Text.Trim();
//ProjectDoc doc = new ProjectDoc();
var doc = new Document();
doc.Load(DBGlobalService.ProjectFile);
DBGlobalService.CurrentProject = new ProjectType(doc);
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
}
示例2: Open
/// <summary>
/// Open an existing file
/// </summary>
/// <param name="path">Path for note</param>
private void Open(string path)
{
try
{
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
{
Document document = new Document();
document.Load(fs);
fNoteBox.Document = document;
fFilePath = path;
fFileName = System.IO.Path.GetFileNameWithoutExtension(path);
Text = fFileName + " - " + TITLE;
fNoteBox.Modified = false;
}
}
catch (Exception e)
{
MessageBox.Show(this, "Unable to open file: " + path + "\n" + e.Message, "Error opening file", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例3: Open
private void Open(string filename)
{
try
{
using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
{
Document document = new Document();
document.Load(fs);
fScribble.Document = document;
//fScribble.Scribble.Highlight(new object[] { "the" });
fFilePath = filename;
fFileName = System.IO.Path.GetFileNameWithoutExtension(filename);
Text = fFileName + " - " + TITLE;
fScribble.Modified = false;
}
}
catch (Exception e)
{
MessageBox.Show(this, "Unable to open file: " + filename + "\n" + e.Message, "Error opening file", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例4: LoadDB
private void LoadDB()
{
string selectDir = GlobalService.CurrentPrj_Dir;
string projectName = GlobalService.CurrentPrj_Name;
string path = System.IO.Path.Combine(selectDir, "");
DBGlobalService.ProjectFile = System.IO.Path.Combine(path, projectName + ".xml");
var doc = new Document();
ProjectType prj = null;
if (!System.IO.File.Exists(DBGlobalService.ProjectFile))
{
var stream = System.IO.File.Create(DBGlobalService.ProjectFile);
stream.Close();
prj = doc.CreateNode<ProjectType>();
}
else
{
doc.Load(DBGlobalService.ProjectFile);
prj = new ProjectType(doc);
}
DBGlobalService.CurrentProjectDoc = doc;
DBGlobalService.CurrentProject = prj;
DBGlobalService.CurrentProject.Name = projectName;
doc.Save(DBGlobalService.ProjectFile);
this.CreateDBTree();
}