Hi every one
I have really got stuck in writting a piece of code.I suppose to create a form with a button on it. when ever button is clicked, a line which is stated from a certain point of the form(200,200) should grow upward.
its the code i have written
namespace ConsoleApplication1
{
class Program :Form
{
int x=202;
int y=202;
public Program()
{
this.Size = new Size(400, 400);
this.BackColor = Color.Wheat;
this.StartPosition = FormStartPosition.CenterScreen;
Button b1 = new Button();
this.Controls.Add(b1);
b1.Click+=new EventHandler(b1_Click);
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
Brush brush = new SolidBrush(Color.Black);
Pen pen = new Pen(brush, 4);
g.DrawLine(pen, 200, 200, 200, 201);
}
protected void b1_Click(object sender, EventArgs e)
{
x = 200;
y = 20;
}
button doesn't work! any suggestions??
thank u in advanced