using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication15
{
public partial class Form1 : Form
{
int dx=10;
int dy=10;
bool rm;
bool bm;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
radioButton1.Left += dx;
radioButton1.Top += dy;
if (radioButton1.Top < ClientRectangle.Top )
{
bm = true;
}
else if (radioButton1.Top > ClientRectangle.Height)
{
bm = false;
}
else if (radioButton1.Left > ClientRectangle.Width)
{
rm = false;
}
else if (radioButton1.Left < ClientRectangle.Left)
{
rm = true;
}
if (rm)
{
dx = 10;
}
else {
dx = -10;
}
if (bm)
{
dy = 10;
}
else
{
dy = -10;
}
}
}
}
'Programing > C#' 카테고리의 다른 글
c# Tan 값구하기,각도 구하기,Math.Tan,Math.Atan (0) | 2017.02.17 |
---|---|
C# 각도구하기,atan (0) | 2017.02.16 |
c# 여러개의 오브젝트와의 충돌검사 (0) | 2017.02.15 |
C# 콘트롤 동적생성및 이벤트 공유 (0) | 2017.02.15 |
먼곳의 물체의 각도 구하기,ATan2,ATan (0) | 2017.02.15 |