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

📄 preferencesdialog.cs

📁 POCKET PC,照片管理系统!提供了真正意义上的目录打开功能
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Resources;
using System.Windows.Forms;
using Addot.Windows.Forms;

namespace Pex
{
	/// <summary>
	/// Summary description for PreferencesDialog.
	/// </summary>
	public class PreferencesDialog : System.Windows.Forms.Form
	{
        #region --- Controls ---
        private System.Windows.Forms.ComboBox cbThumbSize;
        private System.Windows.Forms.Label lbThumbSize;
        private System.Windows.Forms.CheckBox chStrech;
        private System.Windows.Forms.Label lbLabelDefaultFolder;
        private System.Windows.Forms.Label lbDefaultFolder;
        private System.Windows.Forms.Label lbLabelDefaultDisplayMode;
        private System.Windows.Forms.ComboBox cbDefaultDisplay;
        private System.Windows.Forms.CheckBox chDrawRect;
        private System.Windows.Forms.Button btCancel;
        private Addot.Windows.Forms.ImageButton btChangeFolder;
        #endregion Controls

		public PreferencesDialog()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			base.Dispose( disposing );
		}

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PreferencesDialog));
            // 
            // PreferencesDialog
            // 
            this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
            this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
            this.Location = new System.Drawing.Point(0, 0);
            this.Text = resources.GetString("$this.Text");
            // 
            // cbThumbSize
            // 
            this.cbThumbSize = new System.Windows.Forms.ComboBox();
            this.cbThumbSize.Parent = this;
            this.cbThumbSize.Font = ((System.Drawing.Font)(resources.GetObject("cbThumbSize.Font")));
            this.cbThumbSize.Items.Add(resources.GetString("resource"));
            this.cbThumbSize.Items.Add(resources.GetString("resource1"));
            this.cbThumbSize.Items.Add(resources.GetString("resource2"));
            this.cbThumbSize.Location = ((System.Drawing.Point)(resources.GetObject("cbThumbSize.Location")));
            this.cbThumbSize.Size = ((System.Drawing.Size)(resources.GetObject("cbThumbSize.Size")));
            // 
            // lbThumbSize
            // 
            this.lbThumbSize = new System.Windows.Forms.Label();
            this.lbThumbSize.Parent = this;
            this.lbThumbSize.Font = ((System.Drawing.Font)(resources.GetObject("lbThumbSize.Font")));
            this.lbThumbSize.Location = ((System.Drawing.Point)(resources.GetObject("lbThumbSize.Location")));
            this.lbThumbSize.Size = ((System.Drawing.Size)(resources.GetObject("lbThumbSize.Size")));
            this.lbThumbSize.Text = resources.GetString("lbThumbSize.Text");
            // 
            // chDrawRect
            // 
            this.chDrawRect = new System.Windows.Forms.CheckBox();
            this.chDrawRect.Parent = this;
            this.chDrawRect.Font = ((System.Drawing.Font)(resources.GetObject("chDrawRect.Font")));
            this.chDrawRect.Location = ((System.Drawing.Point)(resources.GetObject("chDrawRect.Location")));
            this.chDrawRect.Size = ((System.Drawing.Size)(resources.GetObject("chDrawRect.Size")));
            this.chDrawRect.Text = resources.GetString("chDrawRect.Text");
            // 
            // chStrech
            // 
            this.chStrech = new System.Windows.Forms.CheckBox();
            this.chStrech.Parent = this;
            this.chStrech.Font = ((System.Drawing.Font)(resources.GetObject("chStrech.Font")));
            this.chStrech.Location = ((System.Drawing.Point)(resources.GetObject("chStrech.Location")));
            this.chStrech.Size = ((System.Drawing.Size)(resources.GetObject("chStrech.Size")));
            this.chStrech.Text = resources.GetString("chStrech.Text");
            // 
            // lbLabelDefaultFolder
            // 
            this.lbLabelDefaultFolder = new System.Windows.Forms.Label();
            this.lbLabelDefaultFolder.Parent = this;
            this.lbLabelDefaultFolder.Font = ((System.Drawing.Font)(resources.GetObject("lbLabelDefaultFolder.Font")));
            this.lbLabelDefaultFolder.Location = ((System.Drawing.Point)(resources.GetObject("lbLabelDefaultFolder.Location")));
            this.lbLabelDefaultFolder.Size = ((System.Drawing.Size)(resources.GetObject("lbLabelDefaultFolder.Size")));
            this.lbLabelDefaultFolder.Text = resources.GetString("lbLabelDefaultFolder.Text");
            // 
            // lbDefaultFolder
            // 
            this.lbDefaultFolder = new System.Windows.Forms.Label();
            this.lbDefaultFolder.Parent = this;
            this.lbDefaultFolder.Enabled = false;
            this.lbDefaultFolder.Font = ((System.Drawing.Font)(resources.GetObject("lbDefaultFolder.Font")));
            this.lbDefaultFolder.Location = ((System.Drawing.Point)(resources.GetObject("lbDefaultFolder.Location")));
            this.lbDefaultFolder.Size = ((System.Drawing.Size)(resources.GetObject("lbDefaultFolder.Size")));
            this.lbDefaultFolder.Text = resources.GetString("lbDefaultFolder.Text");
            // 
            // lbLabelDefaultDisplayMode
            // 
            this.lbLabelDefaultDisplayMode = new System.Windows.Forms.Label();
            this.lbLabelDefaultDisplayMode.Parent = this;
            this.lbLabelDefaultDisplayMode.Font = ((System.Drawing.Font)(resources.GetObject("lbLabelDefaultDisplayMode.Font")));
            this.lbLabelDefaultDisplayMode.Location = ((System.Drawing.Point)(resources.GetObject("lbLabelDefaultDisplayMode.Location")));
            this.lbLabelDefaultDisplayMode.Size = ((System.Drawing.Size)(resources.GetObject("lbLabelDefaultDisplayMode.Size")));
            this.lbLabelDefaultDisplayMode.Text = resources.GetString("lbLabelDefaultDisplayMode.Text");
            // 
            // cbDefaultDisplay
            // 
            this.cbDefaultDisplay = new System.Windows.Forms.ComboBox();
            this.cbDefaultDisplay.Parent = this;
            this.cbDefaultDisplay.Font = ((System.Drawing.Font)(resources.GetObject("cbDefaultDisplay.Font")));
            this.cbDefaultDisplay.Items.Add(resources.GetString("resource3"));
            this.cbDefaultDisplay.Items.Add(resources.GetString("resource4"));
            this.cbDefaultDisplay.Location = ((System.Drawing.Point)(resources.GetObject("cbDefaultDisplay.Location")));
            this.cbDefaultDisplay.Size = ((System.Drawing.Size)(resources.GetObject("cbDefaultDisplay.Size")));
            // 
            // btCancel
            // 
            this.btCancel = new System.Windows.Forms.Button();
            this.btCancel.Parent = this;
            this.btCancel.Font = ((System.Drawing.Font)(resources.GetObject("btCancel.Font")));
            this.btCancel.Location = ((System.Drawing.Point)(resources.GetObject("btCancel.Location")));
            this.btCancel.Size = ((System.Drawing.Size)(resources.GetObject("btCancel.Size")));
            this.btCancel.Text = resources.GetString("btCancel.Text");
            this.btCancel.Click += new System.EventHandler(this.OnCancel);
            // 
            // btChangeFolder
            // 
            this.btChangeFolder = new Addot.Windows.Forms.ImageButton();
            this.btChangeFolder.Parent = this;
            this.btChangeFolder.ButtonImage = ((System.Drawing.Image)(resources.GetObject("btChangeFolder.ButtonImage")));
            this.btChangeFolder.ButtonPressedImage = ((System.Drawing.Image)(resources.GetObject("btChangeFolder.ButtonPressedImage")));
            this.btChangeFolder.Location = ((System.Drawing.Point)(resources.GetObject("btChangeFolder.Location")));
            this.btChangeFolder.Size = ((System.Drawing.Size)(resources.GetObject("btChangeFolder.Size")));
            this.btChangeFolder.Click += new System.EventHandler(this.OnChangeFolder);
        }
		#endregion

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad (e);
            this.cbDefaultDisplay.SelectedIndex = (int)Preferences.Singleton.DefaultDisplay;
            this.chDrawRect.Checked = Preferences.Singleton.DrawRectangle;
            this.chStrech.Checked = Preferences.Singleton.StrechSmallToThumbnails;
            this.lbDefaultFolder.Text = Preferences.Singleton.DefaultFolder;
            this.cbThumbSize.SelectedIndex = (int)Preferences.Singleton.ThumbSizeIndex;
        }

        private void OnCancel(object sender, System.EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void OnChangeFolder(object sender, System.EventArgs e)
        {
            ResourceManager rm = new ResourceManager(GetType().Namespace + "." + "PexRes", this.GetType().Assembly);
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            fbd.Description = rm.GetString("PexTitle") + " - " + rm.GetString("ChooseFolder");
            fbd.SelectedPath = Preferences.Singleton.DefaultFolder;
            fbd.ShowDialog();

            if( fbd.DialogResult == DialogResult.OK )
            {
                this.lbDefaultFolder.Text = fbd.SelectedPath;
            }
        }

        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed (e);
            if( this.DialogResult != DialogResult.Cancel )
            {
                Preferences.Singleton.DefaultDisplay = (Preferences.DisplayMode)this.cbDefaultDisplay.SelectedIndex;
                Preferences.Singleton.DefaultFolder = this.lbDefaultFolder.Text;
                Preferences.Singleton.DrawRectangle = this.chDrawRect.Checked;
                Preferences.Singleton.StrechSmallToThumbnails = this.chStrech.Checked;
                Preferences.Singleton.ThumbSizeIndex = (Preferences.ThumbnailsSize)this.cbThumbSize.SelectedIndex;
                if( Preferences.Singleton.HasChanged )
                {
                    Preferences.Singleton.Save();
                }
            }
        }

	}
}

⌨️ 快捷键说明

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