tagCANDY CGI VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
[ツリー表示へ]  [ワード検索]  [Home]

タイトル プログラムの制御について
投稿日: 2015/06/13(Sat) 16:51
投稿者ゆきみち
下記のプログラムで3秒間視標を呈示している最中に誤ってキーボタン(例えば、←↓↑→)を押すと
次のキーイベントが作動してしまいます。3秒間視標を呈示している間だけは、何を押しても反応しない(プログラムが動かない)することは可能なのでしょうか?ご指導のほど宜しくお願い申し上げます。

Public Class Form1
    Dim x, y, i As Single
    Dim a, b, c, d, f, h, k, r, s, w, qw As Single

    Dim BackColor_R, BackColor_G, BackColor_B As Short
    Dim RandoltColor_R, RandoltColor_G, RandoltColor_B As Short
    Private Sub Form1_KeyUp(sender As Object, e As KeyEventArgs) Handles Me.KeyUp
        Dim q As Integer
        Timer1.Enabled = True


        q = e.KeyCode  
        Dim g As Graphics = CreateGraphics()

        a = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
        b = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height

      
        c = 11.6

        d = Math.Sqrt(a * a + b * b)
        f = c * 2.54                
        h = 10 * f / d                    

        x = Me.ClientSize.Width \ 2
        y = Me.ClientSize.Height \ 2


        k = 6 * 10

        r = k / CSng(h)
        s = r * CSng(0.6)


        g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
        g.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality

        
        Dim randoltoRing As New SolidBrush(Color.FromArgb(RandoltColor_R, RandoltColor_G, RandoltColor_B))
        Dim haikei As New SolidBrush(Color.FromArgb(BackColor_R, BackColor_G, BackColor_B))


        g.FillEllipse(randoltoRing, x - r, y - r, r * 2, r * 2)
        g.FillEllipse(haikei, x - s, y - s, s * 2, s * 2)


        g.SmoothingMode = Drawing2D.SmoothingMode.None
        g.PixelOffsetMode = Drawing2D.PixelOffsetMode.None


        s = 8
        w = Int(Rnd() * s) + 1

        If w = 1 Then        
            g.FillRectangle(haikei, x + r * CSng(0.4), y - r * CSng(0.2), r * CSng(0.8), r * CSng(0.4))  
        ElseIf w = 2 Then    
            g.FillRectangle(haikei, x - r * CSng(1.2), y - r * CSng(0.2), r * CSng(0.8), r * CSng(0.4))  
        ElseIf w = 3 Then    
            g.FillRectangle(haikei, x - r * CSng(0.2), y + r * CSng(0.4), r * CSng(0.4), r * CSng(0.8))  
        ElseIf w = 4 Then    
            g.FillRectangle(haikei, x - r * CSng(0.2), y - r * CSng(1.2), r * CSng(0.4), r * CSng(0.8))  
        End If


        Dim myPen2 As New Pen(Color.Red, 1)
        Dim rotatePoint As New PointF(CSng(x), CSng(y))


        Dim myMatrix As New Drawing2D.Matrix()
        myMatrix.RotateAt(45, rotatePoint, Drawing2D.MatrixOrder.Append)
        g.Transform = myMatrix

        If w = 5 Then              
            g.FillRectangle(haikei, x - r * CSng(1.2), y - r * CSng(0.2), r * CSng(0.8), r * CSng(0.4))
        ElseIf w = 6 Then          
            g.FillRectangle(haikei, x + r * CSng(0.4), y - r * CSng(0.2), r * CSng(0.8), r * CSng(0.4))
        ElseIf w = 7 Then          
            g.FillRectangle(haikei, x - r * CSng(0.2), y + r * CSng(0.4), r * CSng(0.4), r * CSng(0.8))
        ElseIf w = 8 Then          
            g.FillRectangle(haikei, x - r * CSng(0.2), y - r * CSng(1.2), r * CSng(0.4), r * CSng(0.8))
        End If

        g.Dispose()


        Timer1.Interval = 3000

        
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

        Dim v As Graphics = CreateGraphics()

        Dim haikei_kakusu As New SolidBrush(Color.FromArgb(BackColor_R, BackColor_G, BackColor_B))
        v.FillEllipse(haikei_kakusu, x - 2 * r, y - 2 * r, r * 2 * 2, r * 2 * 2)
        Timer1.Enabled = False
        v.Dispose()

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        BackColor_R = 255
        BackColor_G = 255
        BackColor_B = 255
        RandoltColor_R = 178
        RandoltColor_G = 100
        RandoltColor_B = 67

        Me.BackColor = Color.FromArgb(BackColor_R, BackColor_G, BackColor_B)

        Timer1.Enabled = True

    End Sub
End Class

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。