文字の意味とフォントの色が一致しないようなテスト(ストループカラーワードテスト;例 あかという文字が緑色で書かれている)を作りたいです.
現在,問題は画像で表示して,その回答が下に出るように以下のコードを書きました.
(回答が正解であれば右クリック,間違いであれば左クリックを押して,どちらを押しても次の問題がでるようにしています.問題の画像と表示される回答は関連性はなく,どちらもただランダムに表示されるようにしています.)
これを5秒毎に問題と下の回答が変わるかつクリックすると問題が変わるというコードに変えたいのですが,タイマーのコードを書いても結局マウスをクリックしないとイベントが起こらず,困っています.
下のコードにはタイマーのコードは入っていません.
どのように変えればよいかアドバイスをお願いいたします.
また違う方法があればそちらも教えていただきたいです.
Private Sub UserForm_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, _
ByVal X As Single, ByVal Y As Single)
Select Case Button
Case 1
Dim strPicture1(9) As String strPicture1(0) = "C:\Users\Desktop\VBA\rr.jpg" strPicture1(1) = "C:\Users\Desktop\VBA\rg.jpg" strPicture1(2) = "C:\Users\Desktop\VBA\rb.jpg" strPicture1(3) = "C:\Users\Desktop\VBA\gr.jpg" strPicture1(4) = "C:\Users\Desktop\VBA\gb.jpg" strPicture1(5) = "C:\Users\Desktop\VBA\gg.jpg" strPicture1(6) = "C:\Users\Desktop\VBA\bb.jpg" strPicture1(7) = "C:\Users\Desktop\VBA\br.jpg" strPicture1(8) = "C:\Users\Desktop\VBA\bg.jpg" p = strPicture1(Int(Rnd() * 9)) Image1.Picture = LoadPicture(p) Dim a As Variant a = Array("あか", "あお", "みどり") L = a(Int(Rnd() * 3)) Label7.Visible = True Label8.Visible = False Label7.Caption = L Label7.Font.Size = 100 Case 2 Dim strPicture2(9) As String strPicture2(0) = "C:\Users\Desktop\VBA\rr.jpg" strPicture2(1) = "C:\Users\Desktop\VBA\rg.jpg" strPicture2(2) = "C:\Users\Desktop\VBA\rb.jpg" strPicture2(3) = "C:\Users\Desktop\VBA\gr.jpg" strPicture2(4) = "C:\Users\Desktop\VBA\gb.jpg" strPicture2(5) = "C:\Users\Desktop\VBA\gg.jpg" strPicture2(6) = "C:\Users\Desktop\VBA\bb.jpg" strPicture2(7) = "C:\Users\Desktop\VBA\br.jpg" strPicture2(8) = "C:\Users\Desktop\VBA\bg.jpg" q = strPicture2(Int(Rnd() * 9)) Image1.Picture = LoadPicture(q) Dim b As Variant b = Array("あか", "あお", "みどり") M = b(Int(Rnd() * 3)) Label7.Visible = False Label8.Visible = True Label8.Caption = M Label8.Font.Size = 100 End Select
End Sub

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/01/14 04:32
2016/01/14 06:19
2016/01/14 10:06
2016/01/14 12:20
2016/01/15 04:45
2016/01/15 06:55
2016/01/15 11:55
2016/01/16 06:36
2016/01/18 00:24
2016/01/18 00:47 編集
2016/01/18 01:15
2016/01/18 01:46
2016/01/18 01:57