1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Blogger
{
/// <summary>
/// Summary description for addentry.
/// </summary>
public class addentry : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox EntryText;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox EntryTitleBox;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public addentry()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
public string Entry
{
get
{
return this.EntryText.Text;
}
}
public string EntryTitle
{
get
{
return this.EntryTitleBox.Text;
}
}
/// <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 Windows Form 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.EntryText = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.EntryTitleBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// EntryText
//
this.EntryText.Location = new System.Drawing.Point(32, 64);
this.EntryText.Multiline = true;
this.EntryText.Name = "EntryText";
this.EntryText.Size = new System.Drawing.Size(536, 136);
this.EntryText.TabIndex = 3;
this.EntryText.Text = "";
this.EntryText.TextChanged += new System.EventHandler(this.EntryText_TextChanged);
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Enabled = false;
this.button1.Location = new System.Drawing.Point(472, 24);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(96, 24);
this.button1.TabIndex = 4;
this.button1.Text = "&Ok";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// EntryTitleBox
//
this.EntryTitleBox.Location = new System.Drawing.Point(112, 16);
this.EntryTitleBox.Name = "EntryTitleBox";
this.EntryTitleBox.Size = new System.Drawing.Size(248, 20);
this.EntryTitleBox.TabIndex = 2;
this.EntryTitleBox.Text = "";
this.EntryTitleBox.TextChanged += new System.EventHandler(this.EntryTitleBox_TextChanged);
//
// label2
//
this.label2.Location = new System.Drawing.Point(32, 16);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(48, 16);
this.label2.TabIndex = 4;
this.label2.Text = "Title";
//
// addentry
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(592, 214);
this.Controls.Add(this.EntryTitleBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.button1);
this.Controls.Add(this.EntryText);
this.Name = "addentry";
this.Text = "addentry";
this.ResumeLayout(false);
}
#endregion
private void EntryText_TextChanged(object sender, System.EventArgs e)
{
Verify();
}
private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void Verify()
{
if (this.Name.Length > 0 &&
this.Entry.Length > 0 &&
this.EntryTitle.Length > 0)
{
this.button1.Enabled = true;
}
else
{
this.button1.Enabled = false;
}
}
private void EntryTitleBox_TextChanged(object sender, System.EventArgs e)
{
Verify();
}
}
}
|