📄 fielddefinition.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Epi;
using Epi.Fields;
using Epi.Windows.Dialogs;
namespace Epi.Windows.MakeView.Dialogs.FieldDefinitionDialogs
{
/// <summary>
/// The Field Definition dialog
/// </summary>
public partial class FieldDefinition : DialogBase
{
#region Fields
/// <summary>
/// The x-coordinate
/// </summary>
protected int xCoordinate;
/// <summary>
/// The y- coordinate
/// </summary>
protected int yCoordinate;
/// <summary>
/// The form mode
/// </summary>
protected FormMode mode;
/// <summary>
/// The page
/// </summary>
protected Page page;
/// <summary>
/// The prompt's font
/// </summary>
protected Font promptFont;
/// <summary>
/// The control's font
/// </summary>
protected Font controlFont;
#endregion Fields
#region Constructors
/// <summary>
/// Default Constsructor, for exclusive use by the designer.
/// </summary>
public FieldDefinition()
{
InitializeComponent();
}
/// <summary>
/// Constructor for the class
/// </summary>
public FieldDefinition(MainForm frm) : base(frm)
{
InitializeComponent();
}
#endregion Constructors
#region Protected Methods
/// <summary>
/// Validate dialog input
/// </summary>
/// <returns>True</returns>
protected virtual bool ValidateDialogInput()
{
//Code logic in Generic Field Definition form
return true;
}
/// <summary>
/// Sets the field's properties based on GUI values
/// </summary>
protected virtual void SetFieldProperties()
{
}
#endregion //Protected Methods
#region Public Methods
/// <summary>
/// Creates a field in the MakeView designer
/// </summary>
/// <param name="xLocation">X coordinate of the control</param>
/// <param name="yLocation">Y coordinate of the control</param>
public void CreateField(int xLocation, int yLocation)
{
this.xCoordinate = xLocation;
this.yCoordinate = yLocation;
this.mode = FormMode.Create;
}
/// <summary>
/// Gets the field defined by this field definition dialog
/// </summary>
public virtual RenderableField Field
{
get
{
return null;
}
}
#endregion //Public Methods
#region Event Handlers
private void btnOk_Click(object sender, System.EventArgs e)
{
if (ValidateDialogInput())
{
SetFieldProperties();
this.DialogResult = DialogResult.OK;
this.Hide();
}
else
{
ShowErrorMessages();
}
}
private void btnPromptFont_Click(object sender, System.EventArgs e)
{
FontDialog dialog = new FontDialog();
if (promptFont != null)
{
dialog.Font = promptFont;
}
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
promptFont = dialog.Font;
}
}
private void btnFieldFont_Click(object sender, System.EventArgs e)
{
FontDialog dialog = new FontDialog();
if (controlFont != null)
{
dialog.Font = controlFont;
}
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
controlFont = dialog.Font;
}
}
#endregion //Event Handlers
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -