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

📄 groupdefinition.cs

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

namespace Epi.Windows.MakeView.Dialogs.FieldDefinitionDialogs
{
    /// <summary>
    /// Field group definition dialog
    /// </summary>
    public partial class GroupDefinition : Form
    {
        #region Fields
        private FieldGroup group;
        #endregion //Fields

		#region Constructors
		/// <summary>
		/// Constructor for the exclusive use by the designer.
		/// </summary>
		public GroupDefinition()
		{
			InitializeComponent();
		}

        /// <summary>
		/// Constructor for the class
		/// </summary>
		/// <param name="group">The group to be edited</param>
		public GroupDefinition(FieldGroup group)
		{
			InitializeComponent();
            this.group = group;
			LoadFormData();
		}
		#endregion //Constructors

        #region Private Methods
        private void LoadFormData()
        {
            txtTitle.Text = group.Title;
            pnlColor.BackColor = group.BackgroundColor;
        }
        #endregion //Private Methods

        #region Public Methods

        /// <summary>
        /// Sets the field's properties based on GUI values
        /// </summary>
        protected void SetFieldProperties()
        {
            group.Title = txtTitle.Text;
            group.Name = group.Page.GetView().ComposeGroupNameFromPromptText(txtTitle.Text);
            group.BackgroundColor = pnlColor.BackColor;
        }

        /// <summary>
        /// Gets the field defined by this field definition dialog
        /// </summary>
        public FieldGroup Group
        {
            get
            {
                return group;
            }
        }
        #endregion	//Public Methods

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

        private void btnColor_Click(object sender, EventArgs e)
        {
            ColorDialog dialog = new ColorDialog();
            dialog.AllowFullOpen = true;
            dialog.AnyColor = true;
            DialogResult result = dialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                pnlColor.BackColor = dialog.Color;
            }
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            SetFieldProperties();
            this.DialogResult = DialogResult.OK;
            this.Hide();
        }
    }
}

⌨️ 快捷键说明

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