private void tsmiNormal_Click(object sender, EventArgs e) { TRTextBox content = (TRTextBox)this.pContent.Controls["content"]; content.BackColor = Color.White; content.ForeColor = Color.Black; }
private void pContent_Resize(object sender, EventArgs e) { Panel p = sender as Panel; if (p.HasChildren) { TRTextBox content = (TRTextBox)p.Controls["content"]; content.Size = p.Size; } }
void Books_Click(object sender, EventArgs e) { ToolStripMenuItem tsmi = sender as ToolStripMenuItem; tb = bs.Find(b => b.BookName.Equals(tsmi.Text)); GenCategoriesMenu(); this.Text = string.Format(APPLICATION_CAPTION, this.tb.Author, "-" + this.tb.BookName, " "); TRTextBox content = (TRTextBox)this.pContent.Controls["content"]; content.Text = ""; }
private void TextReader_Load(object sender, EventArgs e) { this.Text = this.Text = string.Format(APPLICATION_CAPTION, "", "", ""); Image bgimage = Image.FromFile(@"skins\black.gif"); this.pContent.BackgroundImage = bgimage; this.pContent.BackgroundImageLayout = ImageLayout.Tile; cacheDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Settings.Default.CachePath); if (!Directory.Exists(cacheDir)) { Directory.CreateDirectory(cacheDir); } string[] cacheFiles = Directory.GetFiles(cacheDir, "*.txt.~"); foreach (string cacheFile in cacheFiles) { TextBook t = TextBook.Restore(cacheFile); bs.Add(t); ToolStripMenuItem item = new ToolStripMenuItem(t.BookName); item.Click += new EventHandler(Books_Click); this.tsBooks.DropDownItems.Add(item); } content = new TRTextBox(); content.Name = "content"; content.BackgroundImage = bgimage; content.BackgroundImageLayout = ImageLayout.Tile; content.Size = this.pContent.Size; content.ScrollBars = ScrollBars.Vertical; content.Multiline = true; content.Font = new Font("微软雅黑", 20); this.pContent.Controls.Add(content); ResetControl(); }