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

📄 singlelinetextfielddefinition.cs

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

using Epi;
using Epi.Fields;

#endregion	Namespaces

namespace Epi.Windows.MakeView.Dialogs.FieldDefinitionDialogs
{
    /// <summary>
    /// The Single Line Text Field Definition dialog
    /// </summary>
    public partial class SingleLineTextFieldDefinition : TextFieldDefinition
	{
        private SingleLineTextField field;

		#region	Constructors
        /// <summary>
        /// Default Constsructor, for exclusive use by the designer.
        /// </summary>
        public SingleLineTextFieldDefinition()
        {
            InitializeComponent();
        }
		/// <summary>
		/// Constructor for the class
		/// </summary>
		public SingleLineTextFieldDefinition(MainForm frm) : base(frm)
		{
			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 SingleLineTextFieldDefinition(MainForm frm, Page page) : base(frm)
		{
			InitializeComponent();
			this.mode = FormMode.Create;
			this.page = page;
			cbxSize.SelectedIndex = -1;
		}

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

		#region	Private Methods
		private void LoadFormData()
		{
			txtPrompt.Text = field.PromptText;
			txtFieldName.Text = field.Name;
			chkReadOnly.Checked = field.IsReadOnly;
			chkRepeatLast.Checked = field.ShouldRepeatLast;
			chkRequired.Checked = field.IsRequired;
			if (field.MaxLength > 0)
			{
				cbxSize.Text = field.MaxLength.ToString();
			}
			promptFont = field.PromptFont;
			controlFont = field.ControlFont;
		}
		#endregion	//Private Methods

		#region	Protected Methods

        /// <summary>
        /// Sets the field's properties based on GUI values
        /// </summary>
        protected override void SetFieldProperties()
        {
            field.Name = txtFieldName.Text;
            field.PromptText = txtPrompt.Text;
            if (!string.IsNullOrEmpty(cbxSize.Text))
            {
                field.MaxLength = int.Parse(cbxSize.Text.ToString());
            }
            if (promptFont != null)
            {
                field.PromptFont = promptFont;
            }
            if (controlFont != null)
            {
                field.ControlFont = controlFont;
            }
            field.IsRequired = chkRequired.Checked;
            field.IsReadOnly = chkReadOnly.Checked;
            field.ShouldRepeatLast = chkRepeatLast.Checked;
        }
		
		#endregion	//Protected Methods

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

	}
}

⌨️ 快捷键说明

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