大家好! 有哪位朋友有VB液位流動控制元件, 就是管道中的流動效果!有償分享下 QQ 94505309
uj5u.com熱心網友回復:
沒有單獨的此類控制元件,可使用Flash影片顯示來實作,VB有Flash控制元件裝載Flash影片實作。uj5u.com熱心網友回復:
可以自己畫,隨便寫了一段你可以試試看是不是你想要的效果,自定義畫線函式前四個引數是 兩個端點的坐標,后面兩個分別是線條寬度和線條內部分段數新建一個工程。表單里面放一個按鈕,一個picture box 一個timer,粘貼下面代碼看看。
當然這個效果畫出來 還是覺得影片效果有點分不出左右。而且影片之和X坐標有關,垂直的線段就只剩下閃爍了,演算法還是可以調整,但是老婆催著要帶兒子出門了,先貼出來吧。
Private Sub Command1_Click()
Timer1.Interval = 100
Timer1.Enabled = Not (Timer1.Enabled)
End Sub
Private Sub MyLines()
'直線例子
myWaveLine Picture1, 100, 30, 200, 30, 10, 10
'不同分段例子
myWaveLine Picture1, 100, 50, 200, 50, 10, 4
'方向例子
myWaveLine Picture1, 200, 70, 100, 70, 10, 4
'加粗例子
myWaveLine Picture1, 100, 100, 200, 100, 20, 5
'折線例子
myWaveLine Picture1, 100, 120, 180, 200, 20, 10
myWaveLine Picture1, 180, 200, 260, 120, 20, 10
End Sub
Private Sub myWaveLine(obj As Object, x1 As Long, y1 As Long, x2 As Long, y2 As Long, intWidth As Integer, intsplit As Integer)
Static intWave As Long
Dim i As Long
Dim j As Integer
Dim xS As Long, yS As Long
obj.DrawWidth = intWidth
For i = 0 To intsplit - 1
xS = x1 + (x2 - x1) / intsplit * i
yS = y1 + (y2 - y1) / intsplit * i
For j = 0 To 9
obj.Line (xS + (x2 - x1) / 10 / intsplit * j, yS + (y2 - y1) / 10 / intsplit * j)-(xS + (x2 - x1) / 10 / intsplit * (j + 1), yS + (y2 - y1) / 10 / intsplit * (j + 1)), RGB(0, 0, 255 * Cos(((xS + (x2 - x1) / 100 * j + intWave) Mod intsplit) / intsplit * 3.14 / 2))
Next
Next
intWave = intWave + 1
End Sub
Private Sub Form_Load()
Me.ScaleMode = 3
Me.Picture1.ScaleMode = 3
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
Call MyLines
Timer1.Enabled = True
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/57442.html
標籤:控件
上一篇:VB 轉換16進制問題
下一篇:VB.net
