Hello Mohamad
1. you can use some user controls. For example Dev Express XtraRichEdit. See it's Demo
2. Ms Word saves all pages to separated files. If you want to save data of a page in it's own file, (like ms word) have a property for your page class
private string myFilePath;
public string FilePath
{
get
{
return myFilePath;
}
set
{
myFilePath = value;
Load(myFilePath);
}
}
private void Save()
{
}
After loading a new file, create a new instance of your page and initialize it's property.
for example:
private void Load(string myPath)
{
if (!System.IO.File.Exists(myPath))
return;
if(!IsBlank(this))
{
WordPage wordPage = new WordPage();
wordPage.FilePath = myPath;
this.FilePath = string.Empty();
wordPage.Show();
return;
}
}
private bool IsBlank(WordPage wordPage)
{
}
And you can use a static Dictinary to prevent loading a file in 2 Windows.
public static Dictionary<string, WordPage> dictionary = new Dictionary<string. WordPage>();
And:
if(dictionay.ContainsKey("C:\\MyFile.txt"))
{
return;
}
And in FormClosed event:
private void myWordPage_FormClosed(object sender, FormClosedEventArgs e)
{
dictionay.Remove(this.FilePath);
}
I hope it will help you.