본문 바로가기
반응형

Programing/C#13

c# Tan 값구하기,각도 구하기,Math.Tan,Math.Atan //Tan 값구하기 double angle = 45; double radians = angle *(Math.PI / 180); double result = Math.Tan(radians); label1.Text =Convert.ToString( result); //각도 구하기 radians = Math.Atan(result); angle = radians *(180 / Math.PI); label2.Text = Convert.ToString(angle); // atan2 로 각도 구하기 radians = Math.Atan2(10,10); //10 밑변길이,10 높이 angle = radians *(180 / Math.PI); label2.Text = Convert.ToString(angle); 2017. 2. 17.
c# 벽충돌 감지,반사 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 sende.. 2017. 2. 16.
C# 각도구하기,atan label1.Text = Convert.ToString(Math.Atan(1 / 1) / Math.PI * 180);// 각도 구하기 밑변1,높이1 2017. 2. 16.
c# 여러개의 오브젝트와의 충돌검사 int _y = 300; public void check () // 여러개 오브젝트 충돌검사 { int rx = radioButton1.Left; int ry = radioButton1.Top; radioButton1.Top = _y; _y -= 1; for (int i = 0; i < this.Controls.Count; i++) //콘트롤의 갯수만큼 for { if (this.Controls[i] is Button) // 버튼이면 { if (this.Controls[i].Bounds.Contains(rx,ry)) { //충돌되었다면 radioButton1.Text = this.Controls[i].Text; } } } } private void timer1_Tick(object sender, Even.. 2017. 2. 15.
반응형