⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jpegqdialog.cs

📁 这是一个小型的相片管理器
💻 CS
字号:
/*
Copyright (C) 2005  tommazzo

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Virtual Photo Organzier (VPO) version 1.*, Copyright (C) 2005 by tommazzo
Virtual Photo Organzier (VPO) comes with ABSOLUTELY NO WARRANTY. 
This is free software, and you are welcome to redistribute it under certain conditions.
*/

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using VirtualPhotoOrganizer.Photo;
using VirtualPhotoOrganizer.Util;
using TXML;

namespace VirtualPhotoOrganizer.Dialogs
{
	/// <summary>
	/// Zusammenfassung f黵 JpegQDialog.
	/// </summary>
	internal class JpegQDialog : System.Windows.Forms.Form
	{
		Bitmap Image;
		private string Path;

		private System.Windows.Forms.Button bOK;
		private System.Windows.Forms.NumericUpDown numQ;
		private System.Windows.Forms.Label lbPQ;
		private System.Windows.Forms.Label lbHQ;
		private System.Windows.Forms.TrackBar tbQ;
		/// <summary>
		/// Erforderliche Designervariable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public JpegQDialog(Bitmap image, string path) {
			//
			// Erforderlich f黵 die Windows Form-Designerunterst黷zung
			//
			InitializeComponent();

			Image = image;
			Path = path;
//			LoadLanguageStrings();
		}

		/// <summary>
		/// Die verwendeten Ressourcen bereinigen.
		/// </summary>
		protected override void Dispose(bool disposing) {
			if (disposing) {
				if (components != null) {
					components.Dispose();
				}
			}
			base.Dispose(disposing);
		}

		private void LoadLanguageStrings() {
			const string MN = "JpegQDlg";
			string lsTitle;
			string lsPQ;
			string lsHQ;

			try {
				TXmlReader reader = XmlHandler.OpenLangFile();

				lsTitle = reader.GetString(MN, "Title", "Please select your desired quality!");
				lsPQ = reader.GetString(MN, "PQ", "Poor Quality - Small Size");
				lsHQ = reader.GetString(MN, "HQ", "High Quality - Huge Size");

				reader.Close();
			}
			catch {
				lsTitle = "Please select your desired quality!";
				lsPQ = "Poor Quality - Small Size";
				lsHQ = "High Quality - Huge Size";
			}

			this.Text = lsTitle;
			lbPQ.Text = lsPQ;
			lbHQ.Text = lsHQ;
		}

		#region Vom Windows Form-Designer generierter Code
		/// <summary>
		/// Erforderliche Methode f黵 die Designerunterst黷zung. 
		/// Der Inhalt der Methode darf nicht mit dem Code-Editor ge鋘dert werden.
		/// </summary>
		private void InitializeComponent() {
			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(JpegQDialog));
			this.bOK = new System.Windows.Forms.Button();
			this.tbQ = new System.Windows.Forms.TrackBar();
			this.numQ = new System.Windows.Forms.NumericUpDown();
			this.lbPQ = new System.Windows.Forms.Label();
			this.lbHQ = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize) (this.tbQ)).BeginInit();
			((System.ComponentModel.ISupportInitialize) (this.numQ)).BeginInit();
			this.SuspendLayout();
			// 
			// bOK
			// 
			this.bOK.DialogResult = System.Windows.Forms.DialogResult.OK;
			this.bOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bOK.Location = new System.Drawing.Point(224, 112);
			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);
			// 
			// tbQ
			// 
			this.tbQ.Location = new System.Drawing.Point(8, 48);
			this.tbQ.Maximum = 100;
			this.tbQ.Minimum = 1;
			this.tbQ.Name = "tbQ";
			this.tbQ.Size = new System.Drawing.Size(248, 45);
			this.tbQ.TabIndex = 1;
			this.tbQ.Value = 100;
			this.tbQ.Scroll += new System.EventHandler(this.tbQ_Scroll);
			// 
			// numQ
			// 
			this.numQ.Location = new System.Drawing.Point(256, 64);
			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 = 2;
			this.numQ.Value = new decimal(new int[] {
            100,
            0,
            0,
            0});
			this.numQ.ValueChanged += new System.EventHandler(this.numQ_ValueChanged);
			// 
			// lbPQ
			// 
			this.lbPQ.Location = new System.Drawing.Point(8, 16);
			this.lbPQ.Name = "lbPQ";
			this.lbPQ.Size = new System.Drawing.Size(128, 32);
			this.lbPQ.TabIndex = 3;
			this.lbPQ.Text = "Poor Quality - Small Size";
			// 
			// lbHQ
			// 
			this.lbHQ.Location = new System.Drawing.Point(184, 16);
			this.lbHQ.Name = "lbHQ";
			this.lbHQ.Size = new System.Drawing.Size(100, 32);
			this.lbHQ.TabIndex = 4;
			this.lbHQ.Text = "High Quality - Huge Size";
			// 
			// JpegQDialog
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(320, 150);
			this.ControlBox = false;
			this.Controls.Add(this.lbHQ);
			this.Controls.Add(this.lbPQ);
			this.Controls.Add(this.numQ);
			this.Controls.Add(this.tbQ);
			this.Controls.Add(this.bOK);
			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(328, 184);
			this.MinimizeBox = false;
			this.MinimumSize = new System.Drawing.Size(328, 184);
			this.Name = "JpegQDialog";
			this.Text = "Please select your desired quality!";
			((System.ComponentModel.ISupportInitialize) (this.tbQ)).EndInit();
			((System.ComponentModel.ISupportInitialize) (this.numQ)).EndInit();
			this.ResumeLayout(false);
			this.PerformLayout();

		}
		#endregion

		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 bOK_Click(object sender, System.EventArgs e) {
			JpegSaver js = new JpegSaver();
			js.SaveJpeg(Path, Image, (int) numQ.Value);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -