TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Christian L
NA
1
0
Calling Form1_Paint method
Dec 23 2009 9:12 AM
I want to be able to draw an Ellipse at any point on a pictureBox that I click on. The problem is calling up the method that has the code to draw the ellipse. Thanks for your help in advance.
public
partial
class
Form1
:
Form
{
Graphics
graphics;
string
XStr, YStr;
Pen
blackPen =
new
Pen
(
Color
.Black, 3);
Rectangle
rect =
new
Rectangle
(200, 200, 200, 100);
public
Form1()
{
InitializeComponent();
pictureBox1.MouseUp +=
new
MouseEventHandler
(OnMouseup);
}
public
void
Form1_Load(
object
sender,
EventArgs
e)
{
}
private
void
Form1_Paint(
object
sender,
PaintEventArgs
e)
{
Pen
blackPen =
new
Pen
(
Color
.Black, 3);
Rectangle
rect =
new
Rectangle
(200, 200, 200, 100);
e.Graphics.DrawEllipse(blackPen, rect);
}
private
void
pictureBox1_Click(
object
sender,
EventArgs
e)
{
}
public
void
OnMouseup(
object
sender,
MouseEventArgs
e)
{
graphics.DrawEllipse(blackPen, 10, 10, 20, 10);
/*
* XStr = Convert.ToString(e.X);
YStr = Convert.ToString(e.Y);
textBox1.Text = (XStr);
textBox2.Text = (YStr);
*/
}
private
void
textBox1_TextChanged(
object
sender,
EventArgs
e)
{
}
private
void
textBox2_TextChanged(
object
sender,
EventArgs
e)
{
}
Reply
Answers (
2
)
Selectd child nodes only show in data grid from XML document ....
SortedList