那段時間因為《matrix》的火熱,所以都流行用程式做出那種字幕效果。
我就用qb做了個,02年做的。
const matrixtextstreamlength% = 15 'rem 0chr$(27)
for count = 1 to textstreamcount
displaytextstream matrixtextstream(count)
if updatetextstream(matrixtextstream(count)) then
generatetextstream matrixtextstream(count)
end if
next
wend
endsub changetext (textstream as matrixtextstreamtype)
dim count as integer
dim temptext as string
randomize timer
for count = 1 to matrixtextstreamlength - 1
temptext = temptext + chr$(rnd * 222 + 33)
next
textstream.text = " " + temptext
end sub
sub displaytextstream (textstream as matrixtextstreamtype)
dim count as integer
dim charx as integer, chary as single
for count = 1 to matrixtextstreamlength
charx = textstream.x
chary = textstream.y + count
if chary < screentextheight + 1 and chary > 1 then
if charx <= screentextwidth and charx > 0 then
locate int(chary), charx
color (matrixtextstreamlength - count + 1)
print mid$(textstream.text, count, 1);
end if
end if
next
end sub
sub generatematrixpalette
dim count as integer
dim red as integer, green as integer, blue as integer
for count = 1 to matrixtextstreamlength
red = 0
green = 63 - (count - 1) * (64 / matrixtextstreamlength)
blue = 43 - (count - 1) * (44 / matrixtextstreamlength)
palette count, red + green * 256 + blue * 65536
next
end sub
sub generatetextstream (textstream as matrixtextstreamtype)
randomize timer
textstream.x = int(rnd * screentextwidth) + 1
textstream.y = -rnd * matrixtextstreamlength
textstream.speed = rnd + lowestspeed
changetext textstream
end sub
function updatetextstream% (textstream as matrixtextstreamtype)
textstream.y = textstream.y + textstream.speed
changetext textstream
if textstream.y > screentextheight + 1 then
updatetextstream = true
exit function
end if
updatetextstream = false
end function
Winform實現滾動字幕
寫了個winform滾動字幕的 可以由下往上滾,由左往右滾,由右往左滾 其中可以慢慢的滾,類似led滾動螢幕 寫了一個類以便呼叫 graphics ghf null public lablemgr label lb,string rolltext,graphics gh,string rolltyp...
滾動字幕的實現
滾動字幕,簡單來說,就是從下往上,把一些內容順序組織之後,同步移動。這個看似很簡單的效果,在配合實際場景的 內容產生不確定性 這個特點之後,就會有一點點挑戰了。至少,比可以亂飛,可重疊的 b 站式彈幕要麻煩得多。從上面看,也許初步的思路,是建立很多 div 之後,不斷計算它們的位置,就實現了同步滾動...
c 滾動字幕的實現
在c 中其實滾動螢幕的實現很簡單,只需要用到graphics.drawstring方法.graphics.drawstring string s,font font,brush brush,pointf point 在指定位置並且用指定的 brush 和 font 物件繪製指定的文字字串。其中,我們...
C 滾動字幕的實現
效果圖 就是這一行字橫著移動沒有背景,透明的。需要timer控制元件1個 form的 using system using system.collections.generic using system.componentmodel using system.data using system.dr...
c 滾動字幕的實現
在c 中其實滾動螢幕的實現很簡單,只需要用到graphics.drawstring方法.graphics.drawstring string s,font font,brush brush,pointf point 在指定位置並且用指定的 brush 和 font 物件繪製指定的文字字串。其中,我們...