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
Muhammad Adeel
NA
55
14.1k
Collision from boundaries of form.
Jan 25 2015 1:49 AM
I have made two circles of same size on windows form application and then moved them in such a way that they will never be collided and now i want circles to reflect from boundaries of Form how this could be done in a easy way.
private void button11_Click(object sender, EventArgs e)
{
Pen myPen = new Pen(Color.Black);
Pen mypen2 = new Pen(Color.Black);
Graphics formGraphics;
formGraphics = this.CreateGraphics();
int x=100, y=100,x1=200,y1=200;
for (int i = 2; i < 200; i++)
{
this.Refresh();
formGraphics = this.CreateGraphics();
formGraphics.DrawEllipse(myPen, new Rectangle(x + i, y/ i, 100, 100));
formGraphics.DrawEllipse(myPen, new Rectangle(x1 / i, y1 + i, 100, 100));
System.Threading.Thread.Sleep(22);
}
Reply
Answers (
0
)
string program in c-sharp
page break