Option Strict On 'Vista 'VisualBasic2008 Imports System.Drawing.Drawing2D Public Class Form1 Private kyara_suu As Integer = 5 Private kyara(kyara_suu - 1) As Image Private test_kakudo As Integer = 0 Private ichi_x, ichi_y As Integer Public Sub New() ' この呼び出しは、Windows フォーム デザイナで必要です。 InitializeComponent() ' InitializeComponent() 呼び出しの後で初期化を追加します。 kyara(0) = My.Resources.hosi1 : kyara(1) = My.Resources.hosi2 : kyara(2) = My.Resources.hosi3 kyara(3) = My.Resources.kouri1 : kyara(4) = My.Resources.kouri3 End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load PictureBox1.Visible = False End Sub Private Sub G_B(ByVal g As Graphics, ByVal kakudo As Integer, ByVal kyarakuter As Image, ByVal x As Integer, ByVal y As Integer) ' Dim rotatepoint As New PointF(100.0F, 100.0F) Dim rotatepoint As New PointF(x + CInt(kyarakuter.Width / 2), y + CInt(kyarakuter.Height / 2)) Dim myMatrix As New Matrix myMatrix.RotateAt(kakudo, rotatepoint, MatrixOrder.Append) g.Transform = myMatrix g.DrawImage(kyarakuter, x, y) End Sub Private Sub Randamu() Dim random As System.Random random = New System.Random() ichi_x = random.Next(0, PictureBox1.Width - 50) End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick PictureBox1.Invalidate() test_kakudo += 1 If test_kakudo > 360 Then test_kakudo = 0 ichi_y += 1 If ichi_y > PictureBox1.Height - kyara(3).Height Then ichi_y = 0 : Randamu() End If End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint G_B(e.Graphics, test_kakudo, kyara(3), ichi_x, ichi_y) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Start() Randamu() : ichi_y = 0 PictureBox1.Visible = True End Sub End Class