掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
インスタンス同士でお互いに呼び出す (ID:102154)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
引数の練習してからのほうがいいですよ。若葉マークがでてるし。 これ面白いよ。テトリスにも使えるじゃないかなぁ〜カナカナ。 Option Strict On 'VisualBasic2008無料製品 Public Class Form1 Const 色_数 As Integer = 6 Dim 色No(色_数 - 1) As Color Const ブロックの横幅 As Integer = 50 Const ブロックの縦幅 As Integer = 30 Dim r_1 As Random = New Random() Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.Size = New Size(700, 700) Me.BackColor = Color.Gray With PictureBox1 .Size = New Size(510, 500) .Location = New Point(20, 20) .BackColor = Color.Black End With Timer1.Interval = 100 Timer1.Start() '色 色No(0) = Color.Green : 色No(1) = Color.YellowGreen 色No(2) = Color.Blue : 色No(3) = Color.SkyBlue 色No(4) = Color.Purple : 色No(5) = Color.Pink End Sub Sub ブロック表示(ByVal g As Graphics, ByVal 表示横位置 As Integer, ByVal 表示縦位置 As Integer _ , ByVal iro_1 As Color, ByVal iro_2 As Color) Dim グラデーション用変数 As Integer グラデーション用変数 = r_1.Next(20, 30) Dim グラデーション As New Drawing2D.LinearGradientBrush( _ New Point(0, 0), New Point(グラデーション用変数, グラデーション用変数), iro_1, iro_2) g.FillRectangle(グラデーション, 表示横位置, 表示縦位置, ブロックの横幅, ブロックの縦幅) End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint Dim g As Graphics = e.Graphics For ii = 0 To 2 : For i = 0 To 7 ブロック表示(g, 20 + i * ブロックの横幅 + i * 10, 20 + ii * ブロックの縦幅 + ii * 10, 色No(ii * 2), 色No(ii * 2 + 1)) Next : Next End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick PictureBox1.Invalidate() End Sub End Class
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.