john_avi
February 17th, 2009, 12:14 AM
Hi All,
I am new to c# .net programming. I am making an application where I have to draw some shapes on win forms. I want to draw it after "draw" button is clicked. I tried to draw it using Graphics object. But its not appearing. I am attaching sample code.
private void DrawClicked(object sender, EventArgs e)
{
//location of "draw" button
Point ptBtn = buttonDraw.Location ;
int xCord = ptBtn.X;
int yCord = ptBtn.Y;
//location of win form
Point ptDlg = this.Location;
int xStart = ptDlg.X;
int yStart = ptDlg.Y;
//size of "draw" button.
int ibtnWidth = buttonDraw.Width ;
int btnHt = buttonDraw.Height ;
Graphics drawObj = buttonDraw.CreateGraphics();
Pen blackPen = new Pen(Color.Black, 3);
drawObj.DrawPie(blackPen, xStart + yCord, yCord + yStart + btnHt+10, 50, 50, 0, 30);
}
In this form, I have empty space below "draw" button and I want to draw below that button.
can somebody help me what is wrong with above code
I am new to c# .net programming. I am making an application where I have to draw some shapes on win forms. I want to draw it after "draw" button is clicked. I tried to draw it using Graphics object. But its not appearing. I am attaching sample code.
private void DrawClicked(object sender, EventArgs e)
{
//location of "draw" button
Point ptBtn = buttonDraw.Location ;
int xCord = ptBtn.X;
int yCord = ptBtn.Y;
//location of win form
Point ptDlg = this.Location;
int xStart = ptDlg.X;
int yStart = ptDlg.Y;
//size of "draw" button.
int ibtnWidth = buttonDraw.Width ;
int btnHt = buttonDraw.Height ;
Graphics drawObj = buttonDraw.CreateGraphics();
Pen blackPen = new Pen(Color.Black, 3);
drawObj.DrawPie(blackPen, xStart + yCord, yCord + yStart + btnHt+10, 50, 50, 0, 30);
}
In this form, I have empty space below "draw" button and I want to draw below that button.
can somebody help me what is wrong with above code