C#, C♯, C#相談室 Part51
at TECH
868:デフォルトの名無しさん
09/03/21 01:33:51
>>862
ピンポンの動きはよく分からんが、
こんな感じのものを作りたい?
using System;
using System.Drawing;
using System.Windows.Forms;
namespace circ {
public class MainForm : Form {
Timer timer;
int x;
int y;
public MainForm() {
Paint += new PaintEventHandler(MainForm_Paint);
timer = new Timer();
timer.Tick += new EventHandler(timer_Tick);
timer.Interval = 500;
timer.Enabled = true;
}
void MainForm_Paint(object sender, PaintEventArgs e) {
e.Graphics.DrawArc(Pens.Green, x, y, 10, 10, 0, 360);
}
void timer_Tick(object sender, EventArgs e) {
x = (x + 10) % Width;
y = (y + 20) % Height;
Invalidate();
}
}
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5374日前に更新/228 KB
担当:undef