📄 mbookmaker.cs.bak
字号:
// pbar
//
this.pbar.Location = new System.Drawing.Point(8, 152);
this.pbar.Name = "pbar";
this.pbar.Size = new System.Drawing.Size(448, 23);
this.pbar.TabIndex = 1;
//
// lbCheckList
//
this.lbCheckList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lbCheckList.ItemHeight = 12;
this.lbCheckList.Location = new System.Drawing.Point(8, 8);
this.lbCheckList.Name = "lbCheckList";
this.lbCheckList.Size = new System.Drawing.Size(448, 146);
this.lbCheckList.TabIndex = 0;
//
// tabAbout
//
this.tabAbout.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tabAbout.Controls.Add(this.lbAbout);
this.tabAbout.Location = new System.Drawing.Point(4, 24);
this.tabAbout.Name = "tabAbout";
this.tabAbout.Size = new System.Drawing.Size(464, 220);
this.tabAbout.TabIndex = 4;
this.tabAbout.Text = "关于";
//
// lbAbout
//
this.lbAbout.Location = new System.Drawing.Point(8, 8);
this.lbAbout.Name = "lbAbout";
this.lbAbout.Size = new System.Drawing.Size(448, 208);
this.lbAbout.TabIndex = 0;
this.lbAbout.Text = "label7";
this.lbAbout.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// mBookMenu
//
this.mBookMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem5,
this.menuItem7});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3,
this.menuItemExit});
this.menuItem1.Text = "文件(&F)";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "打开(&O)";
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.Text = "保存(&S)";
//
// menuItemExit
//
this.menuItemExit.Index = 2;
this.menuItemExit.Text = "退出(&E)";
this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click);
//
// menuItem5
//
this.menuItem5.Index = 1;
this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem6});
this.menuItem5.Text = "反编译(&U)";
//
// menuItem6
//
this.menuItem6.Index = 0;
this.menuItem6.Text = "打开(&O)";
//
// menuItem7
//
this.menuItem7.Index = 2;
this.menuItem7.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItemAbout});
this.menuItem7.Text = "帮助(&H)";
//
// menuItemAbout
//
this.menuItemAbout.Index = 0;
this.menuItemAbout.Text = "关于(&A)";
this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click);
//
// mBookMaker
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(472, 245);
this.Controls.Add(this.tabs);
this.Menu = this.mBookMenu;
this.Name = "mBookMaker";
this.Text = "mBook制作工具";
this.Closed += new System.EventHandler(this.mBookMaker_Closed);
this.tabs.ResumeLayout(false);
this.tabInfo.ResumeLayout(false);
this.tabCover.ResumeLayout(false);
this.tabText.ResumeLayout(false);
this.tabImage.ResumeLayout(false);
this.tabMake.ResumeLayout(false);
this.tabAbout.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new mBookMaker());
}
private void TB_FocusOn(object sender, System.EventArgs e)
{
if (this.tbTitle.Focused)
{
this.tbTitle.SelectAll();
if (this.tbTitle.SelectedText == "(未命名)")
{
this.tbTitle.Clear();
}
}
if (this.tbAuthor.Focused)
{
this.tbAuthor.SelectAll();
if (this.tbAuthor.SelectedText == "(无名氏)")
{
this.tbAuthor.Clear();
}
}
if (this.tbPublisher.Focused)
{
this.tbPublisher.SelectAll();
if (this.tbPublisher.SelectedText == "(无)")
{
this.tbPublisher.Clear();
}
}
}
private void btOpenDir_Click(object sender, System.EventArgs e)
{
if (this.dlgOpenDir.ShowDialog() == DialogResult.OK)
{
this.tbSaveTo.Text = this.dlgOpenDir.SelectedPath;
}
}
private void tabs_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.iTotalen = 0;
this.iChapStr.Clear();
if (this.tabs.TabPages[this.tabs.SelectedIndex].Text != "1-基本信息")
{
if (this.tbTitle.Text.Length <= 0)
{
this.tabs.SelectedIndex = 0;
MessageBox.Show("请填写书名!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
if (this.tbAuthor.Text.Length <= 0)
{
this.tabs.SelectedIndex = 0;
MessageBox.Show("请填写作者!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
if (this.tabs.TabPages[this.tabs.SelectedIndex].Text == "2-封面图片")
{
if (File.Exists(this.iCoverFile + ".tmp"))
{
File.Delete(this.iCoverFile + ".tmp");
}
if (this.iCoverFile == (Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Remove(0, 8)) + @"\cover.jpg"))
{
SizeF ef1;
string[] textArray1;
this.myCover = Image.FromFile(this.iCoverFile);
Graphics graphics1 = Graphics.FromImage(this.myCover);
ArrayList list1 = new ArrayList();
Font font1 = new Font("宋体", 16f);
string text1 = "";
for (int num1 = 0; num1 < this.tbTitle.Text.Length; num1++)
{
text1 = text1 + this.tbTitle.Text.Substring(num1, 1);
ef1 = graphics1.MeasureString(text1, font1);
if (((int) ef1.Width) > 150)
{
list1.Add(text1.Substring(0, text1.Length - 1));
text1 = this.tbTitle.Text.Substring(num1, 1);
}
}
list1.Add(text1);
for (int num2 = 0; num2 < list1.Count; num2++)
{
ef1 = graphics1.MeasureString((string) list1[num2], font1);
graphics1.DrawString((string) list1[num2], font1, Brushes.White, (float) ((176f - ef1.Width) / 2f), (float) (30 + ((font1.Height + 3) * num2)));
}
graphics1.ReleaseHdc(graphics1.GetHdc());
this.pbPreview.Image = Image.FromFile(this.iCoverFile);
Graphics graphics2 = Graphics.FromImage(this.pbPreview.Image);
for (int num3 = 0; num3 < list1.Count; num3++)
{
ef1 = graphics2.MeasureString((string) list1[num3], font1);
graphics2.DrawString((string) list1[num3], font1, Brushes.White, (float) ((176f - ef1.Width) / 2f), (float) (30 + ((font1.Height + 3) * num3)));
}
graphics2.ReleaseHdc(graphics2.GetHdc());
this.myCover.Save(this.iCoverFile + ".tmp", ImageFormat.Jpeg);
if (this.tbSaveTo.Text.EndsWith(@"\"))
{
textArray1 = new string[5] { "您的缺省封面保存在:\n", Path.GetDirectoryName(this.tbSaveTo.Text), @"\", this.tbTitle.Text, ".jpg" } ;
this.lbDefCover.Text = string.Concat(textArray1);
}
else
{
textArray1 = new string[5] { "您的缺省封面保存在:\n", this.tbSaveTo.Text, @"\", this.tbTitle.Text, ".jpg" } ;
this.lbDefCover.Text = string.Concat(textArray1);
}
}
else if (!File.Exists(this.iCoverFile + ".tmp"))
{
File.Copy(this.iCoverFile, this.iCoverFile + ".tmp", true);
}
}
//**********************
if ((iType == 0) & (tabs.SelectedTab == tabText))//普通书
{
tabs.SelectedTab = tabText;
}
else if ((iType == 1) & (tabs.SelectedTab == tabText))//漫画书
{
tabs.SelectedTab = tabImage;
MessageBox.Show("漫画书不设计目录内容,\n设计目录图片", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
if ((iType == 0) & (tabs.SelectedTab == tabImage))//普通书
{
tabs.SelectedTab = tabText;
MessageBox.Show("普通书不设计目录图片,\n设计目录内容", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else if ((iType == 1) & (tabs.SelectedTab == tabImage))//漫画书
{
tabs.SelectedTab = tabImage;
}
//**********************
if (this.tabs.TabPages[this.tabs.SelectedIndex].Text == "3-目录图片")
{
this.fromMhPreview.Show();
}else
{
this.fromMhPreview.Hide();
}
//**********************
if (((this.tabs.TabPages[this.tabs.SelectedIndex].Text != "3-目录内容") && (this.lbChapters.SelectedIndex >= 0)) && ((this.lbChapters.SelectedIndex < this.iChapter.Count) && this.iModified))
{
this.iChapter[this.lbChapters.SelectedIndex] = this.tbText.Text;
this.iModified = false;
}
if (this.tabs.TabPages[this.tabs.SelectedIndex].Text == "3-目录内容")
{
this.lbModified.Visible = this.iModified;
}
if (this.tabs.TabPages[this.tabs.SelectedIndex].Text == "4-确认制作")
{
this.lbCheckList.Items.Clear();
if (iType == 0)//普通书
{
this.lbCheckList.Items.Add(string.Format("图书类型:普通书"));
}else if (iType == 1)//漫画书
{
this.lbCheckList.Items.Add(string.Format("图书类型:漫画书"));
}
this.lbCheckList.Items.Add(" ");
this.lbCheckList.Items.Add(string.Format("书名标题:{0}", this.tbTitle.Text));
this.lbCheckList.Items.Add(string.Format("作 者:{0}", this.tbAuthor.Text));
this.lbCheckList.Items.Add(string.Format("出版日期:{0}", this.dtpDate.Text));
this.lbCheckList.Items.Add(string.Format("体裁类型:{0}", this.cbGender.Text));
this.lbCheckList.Items.Add(string.Format("出版发行:{0}", this.tbPublisher.Text));
if (File.Exists(this.iCoverFile))
{
this.lbCheckList.Items.Add(string.Format("封面文件:{0}", this.iCoverFile));
}
else
{
this.lbCheckList.Items.Add("封面文件:(无)");
}
this.lbCheckList.Items.Add(" ");
if (iType == 0)//普通书
{
this.lbCheckList.Items.Add(string.Format("章节目录:共({0})个", this.lbChapters.Items.Count));
this.iTotalen = 0;
if ((this.lbChapters.Items.Count > 0) && (this.iChapter.Count > 0))
{
for (int num4 = 0; num4 < this.lbChapters.Items.Count; num4++)
{
this.lbCheckList.Items.Add(string.Format("第{0}章:(长度:{1} 字节)", num4 + 1, ((string) this.iChapter[num4]).Length * 2));
this.iTotalen += ((((string) this.iChapter[num4]).Length + 1) * 2);
this.iChapStr.Add(this.lbChapters.Items[num4]);
this.lbCheckList.Items.Add(string.Format(" 标题:{0}", (string) this.lbChapters.Items[num4]));
}
}
this.lbCheckList.Items.Add(" ");
this.lbCheckList.Items.Add(string.Format("内容总长:{0} 字节", this.iTotalen));
this.lbCheckList.Items.Add(" ");
this.lbCheckList.Items.Add("准备制作...");
this.lbCheckList.Items.Add(" ");
}else if (iType == 1)//漫画书
{
if (checkUserChap.Checked)
{
this.lbCheckList.Items.Add(string.Format("章节目录:共({0})个", this.lbMhChapters.Items.Count));
this.iTotalen = 0;
if ((this.lbMhChapters.Items.Count > 0) && (this.MHChapterArray.Count > 0))
{
for (int num4 = 0; num4 < this.lbMhChapters.Items.Count; num4++)
{
MHChapter tmpMHChapter = (MHChapter)this.MHChapterArray[num4];
this.lbCheckList.Items.Add(string.Format("第{0}章:(共有:{1} 个图片)", num4 + 1,tmpMHChapter.JpgFileNameArray.Count));
this.lbCheckList.Items.Add(string.Format(" 标题:{0}", tmpMHChapter.ChapterStr));
}
}
}else
{
this.lbCheckList.Items.Add(string.Format("无章节目录:共有{0} 个图片",lbJpgFile.Items.Count));
}
this.lbCheckList.Items.Add("准备制作...");
this.lbCheckList.Items.Add(" ");
}
}
}
private void btSelCover_Click(object sender, System.EventArgs e)
{
FileStream stream1;
if (File.Exists(this.iCoverFile + ".tmp"))
{
File.Delete(this.iCoverFile + ".tmp");
}
this.dlgOpenFile.Filter = "封面文件(*.jpg)|*.jpg";
bool flag1 = false;
do
{
if (this.dlgOpenFile.ShowDialog() != DialogResult.OK)
{
return;
}
this.iCoverFile = this.dlgOpenFile.FileName;
stream1 = File.OpenRead(this.dlgOpenFile.FileName);
if (stream1.Length < 0x4000)
{
flag1 = true;
}
else
{
MessageBox.Show("您指定的封面文件过大!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
while (!flag1);
stream1.Close();
File.Copy(this.iCoverFile, this.iCoverFile + ".tmp", true);
this.pbPreview.Image = Image.FromFile(this.iCoverFile);
this.pbPreview.Width = this.pbPreview.Image.Width;
this.pbPreview.Height = this.pbPreview.Image.Height;
if (this.pbPreview.Width > 0xb0)
{
this.pbPreview.Width = 0xb0;
}
if (this.pbPreview.Height > 0xd0)
{
this.pbPreview.Height = 0xd0;
}
}
private void btDefCover_Click(object sender, System.EventArgs e)
{
this.iCoverFile = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase.Remove(0, 8)) + @"\cover.jpg";
if (this.pbPreview.Width < 0xb0)
{
this.pbPreview.Width = 0xb0;
}
if (this.pbPreview.Height < 0xd0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -