掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
下記のプログラムを直すには? (ID:87617)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
年寄りの冷や水さん >波形をみやすく描画するためYYY = YYY + 10としていたことが問題 あんまり細かくやろうとすると、グラッフィクが追いつきませんね。 ぷちさん 罫線固定もあまり上手く言っていないような。一応サンプル載せておきますね。 要するにFrameを細くして罫線に見せています。 '*****************準備する物****************************** '1 Formの上にFrame1を置く '2 Frame1の上にPicture1(0)とPicture1(1)を置く '3 Frame1の上にFrame2とFrame3を置きindexを0とする '4 Formの上にTimeer1を置く '********************************************************* Option Explicit Const TTT = 80 '横の送り Const Colno = 10 '横の分割 Const Rowno = 20 '縦の分割 Private Sub Form_Load() Dim n As Integer 'フォームの大きさ--適当に Me.Width = TTT * 120 'フォーム・ピクチャボックスの大きさ設定 Me.Height = 6720 With Frame1 .Top = 240 .Width = Me.Width - 400 .Left = 100 .Height = Me.Height - 1000 .BackColor = RGB(20, 20, 20) .Appearance = 0 End With For n = 1 To 10 Load Frame2(n) '横の線を追加 Next For n = 1 To 20 Load Frame3(n) '縦の線の追加 Next For n = 0 To 1 With Picture1(n) .Width = Frame1.Width - 20 .Height = Frame1.Height - 20 .Left = 0 .Top = 0 .AutoRedraw = True .DrawWidth = 2 .DrawStyle = 0 .Appearance = 0 .BorderStyle = 0 .ForeColor = RGB(0, 255, 200) .BackColor = RGB(0, 0, 0) '背景色を黒に設定 End With Next Picture1(1).Left = Picture1(0).Left + Picture1(0).Width Timer1.Interval = 100 Timer1.Enabled = True ScaleDraw End Sub Private Sub ScaleDraw() Dim n As Integer For n = 0 To 10 With Frame2(n) .Width = Picture1(0).Width .Top = (Picture1(0).Height) / 10 * n + Picture1(0).Top .Height = 5 .Left = Picture1(0).Left .Appearance = 0 .BackColor = RGB(100, 100, 0) .BorderStyle = 0 .Caption = "" .ZOrder .Visible = True End With Next Frame2(5).BackColor = RGB(180, 200, 0) '中央線を強調 For n = 0 To 20 With Frame3(n) .Left = (Picture1(0).Width) / 20 * n + Picture1(0).Left .Top = 0 .Width = 5 .Height = Picture1(0).Height .Appearance = 0 .BackColor = RGB(100, 100, 0) .BorderStyle = 0 .Caption = "" .ZOrder .Visible = True End With Next End Sub Private Sub Timer1_Timer() Draw End Sub Private Sub Draw() Dim Y As Integer Static OLD_X As Integer Static OLD_Y As Integer Y = Int(Rnd * Picture1(0).Height) '描画が端に来たらPictureを切り替える If OLD_X >= Picture1(0).Width Then If Picture1(0).Left <= Picture1(1).Left Then Picture1(0).Left = Picture1(1).Left + Picture1(1).Width Picture1(0).Cls Else Picture1(1).Left = Picture1(0).Left + Picture1(0).Width Picture1(1).Cls End If OLD_X = 0 End If DoEvents '常に右側のPictureに描画 If Picture1(0).Left <= Picture1(1).Left Then Picture1(1).Line (OLD_X, OLD_Y)-(OLD_X + TTT, Y) Picture1(0).Left = Picture1(0).Left - TTT Picture1(1).Left = Picture1(0).Left + Picture1(0).Width Else Picture1(0).Line (OLD_X, OLD_Y)-(OLD_X + TTT, Y) Picture1(1).Left = Picture1(1).Left - TTT Picture1(0).Left = Picture1(1).Left + Picture1(1).Width End If OLD_X = OLD_X + TTT OLD_Y = Y DoEvents End Sub
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.