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

📄 imagefielddefinition.cs

📁 EpiInfo 开源的导航系统远程序,不知道在哪里下的了,分享一下,有兴趣的
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Epi.Fields;


namespace Epi.Windows.MakeView.Dialogs.FieldDefinitionDialogs
{
    public partial class ImageFieldDefinition : GenericFieldDefinition
    {
        private ImageField field;

        #region	Constructors
        /// <summary>
        /// Default Constsructor, for exclusive use by the designer.
        /// </summary>
        public ImageFieldDefinition()
        {
            InitializeComponent();
        }

		/// <summary>
		/// Constructor for the class
		/// </summary>
        /// <param name="frm">The parent form</param>
		/// <param name="page">Page the field will belong to</param>
		public ImageFieldDefinition(MainForm frm, Page page) : base(frm)
		{
			InitializeComponent();
			this.mode = FormMode.Create;
			this.page = page;
		}

		/// <summary>
		/// Constructor for the class
		/// </summary>
        /// <param name="frm">The parent form</param>
		/// <param name="field">The fied to be edited</param>
		public ImageFieldDefinition(MainForm frm, ImageField field) : base(frm)
		{
			InitializeComponent();
			this.mode = FormMode.Edit;
			this.field = field;
			this.page = field.Page;
			LoadFormData();
		}
		#endregion	Constructors

        #region	Private Methods

        private void LoadFormData()
        {
            txtPrompt.Text = field.PromptText;
            txtFieldName.Text = field.Name;
            chkRetainSize.Checked = field.ShouldRetainImageSize;
            promptFont = field.PromptFont;
        }
        #endregion	//Private Methods

        #region Public Methods

        /// <summary>
        /// Sets the field's properties based on GUI values
        /// </summary>
        protected override void SetFieldProperties()
        {
            field.Name = txtFieldName.Text;
            field.PromptText = txtPrompt.Text;
            field.ShouldRetainImageSize = chkRetainSize.Checked;
            if (promptFont != null)
            {
                field.PromptFont = promptFont;
            }
        }

        /// <summary>
        /// Gets the field defined by this field definition dialog
        /// </summary>
        public override RenderableField Field
        {
            get
            {
                return field;
            }
        }
        #endregion	//Public Methods


        private void btnFont_Click(object sender, EventArgs e)
        {
            FontDialog dialog = new FontDialog();
            if (promptFont != null)
            {
                dialog.Font = promptFont;
            }
            DialogResult result = dialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                promptFont = dialog.Font;
            }
        }
    }
}

⌨️ 快捷键说明

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