Windows Form File /AgentMovieEditor/Modals/EditWindow.cs (C#)
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace YariSoft.AgentMovieEditor.Modals
{
public class EditWindow : BaseEditForm
{
private System.Windows.Forms.TextBox valueEdit;
private System.Windows.Forms.Label editLabel;
private System.ComponentModel.IContainer components = null;
public EditWindow()
{
// This call is required by the Windows Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitializeComponent call
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.editLabel = new System.Windows.Forms.Label();
this.valueEdit = new System.Windows.Forms.TextBox();
this.bottomPanel.SuspendLayout();
this.SuspendLayout();
//
// bottomPanel
//
this.bottomPanel.Location = new System.Drawing.Point(0, 53);
this.bottomPanel.Size = new System.Drawing.Size(294, 35);
this.bottomPanel.Visible = true;
//
// cancelButton
//
this.cancelButton.Location = new System.Drawing.Point(204, 8);
this.cancelButton.Visible = true;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(124, 8);
this.okButton.Visible = true;
//
// editLabel
//
this.editLabel.AutoSize = true;
this.editLabel.Location = new System.Drawing.Point(15, 8);
this.editLabel.Name = "editLabel";
this.editLabel.Size = new System.Drawing.Size(77, 13);
this.editLabel.TabIndex = 2;
this.editLabel.Text = "Please specify";
//
// valueEdit
//
this.valueEdit.HideSelection = false;
this.valueEdit.Location = new System.Drawing.Point(15, 29);
this.valueEdit.Name = "valueEdit";
this.valueEdit.Size = new System.Drawing.Size(264, 20);
this.valueEdit.TabIndex = 0;
this.valueEdit.Text = "";
this.valueEdit.KeyDown += new System.Windows.Forms.KeyEventHandler(this.valueEdit_KeyDown);
//
// EditWindow
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(294, 88);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.bottomPanel,
this.editLabel,
this.valueEdit});
this.Name = "EditWindow";
this.Closing += new System.ComponentModel.CancelEventHandler(this.EditWindow_Closing);
this.bottomPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
public bool Init( string WindowCaption, string LabelText, string Value )
{
this.Text = WindowCaption;
this.editLabel.Text = LabelText;
this.Value = Value;
this.valueEdit.Text = Value;
return true;
}
private void valueEdit_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if( e.KeyCode == Keys.Return ){
this.DialogResult = DialogResult.OK;
this.Close();
}
}
private void EditWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.Value = this.valueEdit.Text;
}
}
}