📄 htmlexportdialog.cs
字号:
this.lbMHeight.TabIndex = 7;
this.lbMHeight.Text = "Max. Height:";
//
// numWidth
//
this.numWidth.Enabled = false;
this.numWidth.Location = new System.Drawing.Point(136, 200);
this.numWidth.Maximum = new decimal(new int[] {
5000,
0,
0,
0});
this.numWidth.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numWidth.Name = "numWidth";
this.numWidth.Size = new System.Drawing.Size(88, 20);
this.numWidth.TabIndex = 9;
this.numWidth.Value = new decimal(new int[] {
1024,
0,
0,
0});
//
// numHeight
//
this.numHeight.Enabled = false;
this.numHeight.Location = new System.Drawing.Point(336, 200);
this.numHeight.Maximum = new decimal(new int[] {
5000,
0,
0,
0});
this.numHeight.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numHeight.Name = "numHeight";
this.numHeight.Size = new System.Drawing.Size(88, 20);
this.numHeight.TabIndex = 10;
this.numHeight.Value = new decimal(new int[] {
768,
0,
0,
0});
//
// cbDiffQ
//
this.cbDiffQ.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cbDiffQ.Location = new System.Drawing.Point(24, 272);
this.cbDiffQ.Name = "cbDiffQ";
this.cbDiffQ.Size = new System.Drawing.Size(248, 24);
this.cbDiffQ.TabIndex = 12;
this.cbDiffQ.Text = "Save Photos with a different quality setting";
this.cbDiffQ.CheckedChanged += new System.EventHandler(this.cbDiffQ_CheckedChanged);
//
// lbHQ
//
this.lbHQ.Enabled = false;
this.lbHQ.Location = new System.Drawing.Point(288, 304);
this.lbHQ.Name = "lbHQ";
this.lbHQ.Size = new System.Drawing.Size(100, 32);
this.lbHQ.TabIndex = 14;
this.lbHQ.Text = "High Quality - Huge Size";
//
// lbPQ
//
this.lbPQ.Enabled = false;
this.lbPQ.Location = new System.Drawing.Point(40, 304);
this.lbPQ.Name = "lbPQ";
this.lbPQ.Size = new System.Drawing.Size(128, 32);
this.lbPQ.TabIndex = 13;
this.lbPQ.Text = "Poor Quality - Small Size";
//
// numQ
//
this.numQ.Enabled = false;
this.numQ.Location = new System.Drawing.Point(368, 352);
this.numQ.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numQ.Name = "numQ";
this.numQ.Size = new System.Drawing.Size(56, 20);
this.numQ.TabIndex = 14;
this.numQ.Value = new decimal(new int[] {
100,
0,
0,
0});
this.numQ.ValueChanged += new System.EventHandler(this.numQ_ValueChanged);
//
// tbQ
//
this.tbQ.Enabled = false;
this.tbQ.Location = new System.Drawing.Point(40, 336);
this.tbQ.Maximum = 100;
this.tbQ.Minimum = 1;
this.tbQ.Name = "tbQ";
this.tbQ.Size = new System.Drawing.Size(320, 45);
this.tbQ.TabIndex = 13;
this.tbQ.Value = 100;
this.tbQ.Scroll += new System.EventHandler(this.tbQ_Scroll);
//
// bOK
//
this.bOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.bOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.bOK.Location = new System.Drawing.Point(288, 400);
this.bOK.Name = "bOK";
this.bOK.Size = new System.Drawing.Size(75, 23);
this.bOK.TabIndex = 0;
this.bOK.Text = "OK";
this.bOK.Click += new System.EventHandler(this.bOK_Click);
//
// bCancel
//
this.bCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.bCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.bCancel.Location = new System.Drawing.Point(384, 400);
this.bCancel.Name = "bCancel";
this.bCancel.Size = new System.Drawing.Size(75, 23);
this.bCancel.TabIndex = 1;
this.bCancel.Text = "Cancel";
//
// lbLang
//
this.lbLang.Location = new System.Drawing.Point(16, 72);
this.lbLang.Name = "lbLang";
this.lbLang.Size = new System.Drawing.Size(96, 16);
this.lbLang.TabIndex = 17;
this.lbLang.Text = "Language:";
//
// cbLang
//
this.cbLang.Location = new System.Drawing.Point(120, 72);
this.cbLang.Name = "cbLang";
this.cbLang.Size = new System.Drawing.Size(160, 21);
this.cbLang.TabIndex = 4;
this.cbLang.Text = "comboBox1";
//
// cbDesc
//
this.cbDesc.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.cbDesc.Location = new System.Drawing.Point(24, 104);
this.cbDesc.Name = "cbDesc";
this.cbDesc.Size = new System.Drawing.Size(256, 16);
this.cbDesc.TabIndex = 5;
this.cbDesc.Text = "Export Descriptions";
//
// sfd
//
this.sfd.Filter = "*.htm|*.htm";
//
// lbRF
//
this.lbRF.Enabled = false;
this.lbRF.Location = new System.Drawing.Point(40, 232);
this.lbRF.Name = "lbRF";
this.lbRF.Size = new System.Drawing.Size(100, 32);
this.lbRF.TabIndex = 20;
this.lbRF.Text = "Resize Filter:";
//
// cbFilt
//
this.cbFilt.Enabled = false;
this.cbFilt.Items.AddRange(new object[] {
"Bicubic",
"High-Quality Bicubic",
"Bilinear",
"High-Quality Bilinear",
"Nearest Neighbor"});
this.cbFilt.Location = new System.Drawing.Point(152, 232);
this.cbFilt.Name = "cbFilt";
this.cbFilt.Size = new System.Drawing.Size(152, 21);
this.cbFilt.TabIndex = 11;
this.cbFilt.Text = "Bicubic";
//
// HTMLExportDialog
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(480, 438);
this.Controls.Add(this.cbFilt);
this.Controls.Add(this.lbRF);
this.Controls.Add(this.cbDesc);
this.Controls.Add(this.cbLang);
this.Controls.Add(this.lbLang);
this.Controls.Add(this.bCancel);
this.Controls.Add(this.bOK);
this.Controls.Add(this.lbHQ);
this.Controls.Add(this.lbPQ);
this.Controls.Add(this.numQ);
this.Controls.Add(this.tbQ);
this.Controls.Add(this.cbDiffQ);
this.Controls.Add(this.numHeight);
this.Controls.Add(this.numWidth);
this.Controls.Add(this.lbMHeight);
this.Controls.Add(this.lbMWidth);
this.Controls.Add(this.cbResize);
this.Controls.Add(this.bTColor);
this.Controls.Add(this.bBGColor);
this.Controls.Add(this.lbMAF);
this.Controls.Add(this.bBrowse);
this.Controls.Add(this.tbMAF);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(488, 472);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(488, 472);
this.Name = "HTMLExportDialog";
this.Text = "HTMLExportDialog";
((System.ComponentModel.ISupportInitialize) (this.numWidth)).EndInit();
((System.ComponentModel.ISupportInitialize) (this.numHeight)).EndInit();
((System.ComponentModel.ISupportInitialize) (this.numQ)).EndInit();
((System.ComponentModel.ISupportInitialize) (this.tbQ)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private void bBGColor_Click(object sender, System.EventArgs e) {
// show the bg color dialog
if (cdBg.ShowDialog() == DialogResult.OK)
bBGColor.ForeColor = cdBg.Color;
}
private void bTColor_Click(object sender, System.EventArgs e) {
// show the text color dialog
if (cdText.ShowDialog() == DialogResult.OK)
bTColor.ForeColor = cdText.Color;
}
private void cbResize_CheckedChanged(object sender, System.EventArgs e) {
lbMWidth.Enabled = cbResize.Checked;
lbMHeight.Enabled = cbResize.Checked;
numWidth.Enabled = cbResize.Checked;
numHeight.Enabled = cbResize.Checked;
lbRF.Enabled = cbResize.Checked;
cbFilt.Enabled = cbResize.Checked;
if (cbResize.Checked == true) {
cbDiffQ.Checked = cbResize.Checked;
cbDiffQ.Enabled = false;
} else
cbDiffQ.Enabled = true;
}
private void cbDiffQ_CheckedChanged(object sender, System.EventArgs e) {
lbPQ.Enabled = cbDiffQ.Checked;
lbHQ.Enabled = cbDiffQ.Checked;
numQ.Enabled = cbDiffQ.Checked;
tbQ.Enabled = cbDiffQ.Checked;
}
private void bOK_Click(object sender, System.EventArgs e) {
this.DialogResult = DialogResult.OK;
HTMLExporter exp = new HTMLExporter(Photos, cbDesc.Checked, cbLang.Text);
// get the directory and maf names
System.IO.FileInfo fi = new System.IO.FileInfo(tbMAF.Text);
string destPath = fi.Directory.FullName;
string maf = fi.Name;
// get the interpolationMode
System.Drawing.Drawing2D.InterpolationMode intMode;
switch (cbFilt.SelectedIndex) {
case 0: intMode = System.Drawing.Drawing2D.InterpolationMode.Bicubic;
break;
case 1: intMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
break;
case 2: intMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
break;
case 3: intMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear;
break;
case 4: intMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
break;
default: intMode = System.Drawing.Drawing2D.InterpolationMode.Bicubic;
break;
}
if (cbResize.Checked == true) // shall we resize the photos during export?
exp.Export(destPath, maf, cdBg.Color, cdText.Color, (int) numWidth.Value, (int) numHeight.Value, (int) numQ.Value, intMode);
else {
if (cbDiffQ.Checked == true) // shall we just save the photos with a different quality?
exp.Export(destPath, maf, cdBg.Color, cdText.Color, (int) numQ.Value);
else
exp.Export(destPath, maf, cdBg.Color, cdText.Color); // just copy the photos
}
}
private void tbQ_Scroll(object sender, System.EventArgs e) {
numQ.Value = tbQ.Value;
}
private void numQ_ValueChanged(object sender, System.EventArgs e) {
tbQ.Value = (int) numQ.Value;
}
private void bBrowse_Click(object sender, System.EventArgs e) {
if (sfd.ShowDialog() == DialogResult.OK)
tbMAF.Text = sfd.FileName;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -