using System;
using System.Drawing;
using System.Windows.Forms;
class MessageButtonDemo: Form
{
[STAThread]
public static void Main()
{
Application.Run(new MessageButtonDemo());
}
public MessageButtonDemo()
{
MessageButton msgbtn = new MessageButton();
msgbtn.Parent = this;
msgbtn.Text = "Calculate";
msgbtn.MessageBoxText = "This button is not yet implemented!";
msgbtn.Location = new Point(50, 50);
msgbtn.AutoSize = true;
}
}
class MessageButton: Button
{
string str;
public MessageButton()
{
Enabled = false;
}
public string MessageBoxText
{
set
{
str = value;
Enabled = value != null && value.Length > 3;
}
get
{
return str;
}
}
protected override void OnClick(EventArgs args)
{
MessageBox.Show(MessageBoxText, Text);
}
}
|