我的做法是先寫(xiě)入一個(gè)圖片變量,然后再寫(xiě)入到容器上。容器設(shè)置雙緩沖
創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,提供網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);可快速的進(jìn)行網(wǎng)站開(kāi)發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛(ài)的網(wǎng)站,是專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來(lái)合作!
還有你說(shuō)的控件必須透明不太明白,可以直接在容器上繪圖,不需要控件,圖片的透明度可以用RGBA色的A值(透明度)來(lái)控制
我這個(gè)也是實(shí)時(shí)翻滾刷新的,不會(huì)閃!
不用那么麻煩吧,利用Random實(shí)現(xiàn).
Dim a As Integer
Dim r As New Random
a = r.Next(4, 99)
方法名稱:next();功能描述:返回一個(gè)0~2147483647之間的整數(shù)
方法名稱:next(i);功能描述:返回一個(gè)0~i之間的整數(shù)
方法名稱:next(i,j);功能描述:返回一個(gè)i~j之間的整數(shù)
方法名稱:Nextdouble();功能描述:返回一個(gè)0~1之間的隨機(jī)小數(shù)
================
使用方法:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim rand = New System.Random()
MsgBox(rand.next().ToString())
End Sub
==========================
產(chǎn)生N個(gè)不同數(shù)的話,我給你個(gè)我寫(xiě)的VB的代碼,你稍微改下:
產(chǎn)生0-10的數(shù):
Private Sub Command1_Click()
Randomize
Dim a(10) As Long
n = 10
For i = 0 To n
a(i) = Int(Rnd() * (n + 1))
For j = 0 To i - 1
If a(i) = a(j) Then
i = i - 1
Exit For
End If
Next
Next
For i = 0 To n
Print a(i)
Next
End Sub
這篇文章介紹了VB.NET設(shè)置屏幕分辨率、顏色位數(shù)、刷新率
實(shí)例代碼,有需要的朋友可以參考一下
復(fù)制代碼
代碼如下:
Private
Declare
Function
GetDeviceCaps
Lib
"gdi32"
(ByVal
hdc
As
Long,
ByVal
nIndex
As
Long)
As
Long
Private
Declare
Function
ChangeDisplaySettings
Lib
"user32"
Alias
"ChangeDisplaySettingsA"
(lpDevMode
As
Any,
ByVal
dwflags
As
Long)
As
Long
Private
Const
CCDEVICENAME
As
Long
=
32
Private
Const
CCFORMNAME
As
Long
=
32
Private
Const
DM_BITSPERPEL
As
Long
=
H40000
Private
Const
DM_PELSWIDTH
As
Long
=
H80000
Private
Const
DM_PELSHEIGHT
As
Long
=
H100000
Private
Const
DM_DISPLAYFLAGS
As
Long
=
H200000
Private
Const
DM_DISPLAYFREQUENCY
=
H400000
Private
Const
CDS_FORCE
As
Long
=
H80000000
Private
Const
BITSPIXEL
As
Long
=
12
Private
Const
HORZRES
As
Long
=
8
Private
Const
VERTRES
As
Long
=
10
Private
Const
VREFRESH
=
116
Private
Type
DEVMODE
dmDeviceName
As
String
*
CCDEVICENAME
dmSpecVersion
As
Integer
dmDriverVersion
As
Integer
dmSize
As
Integer
dmDriverExtra
As
Integer
dmFields
As
Long
dmOrientation
As
Integer
dmPaperSize
As
Integer
dmPaperLength
As
Integer
dmPaperWidth
As
Integer
dmScale
As
Integer
dmCopies
As
Integer
dmDefaultSource
As
Integer
dmPrintQuality
As
Integer
dmColor
As
Integer
dmDuplex
As
Integer
dmYResolution
As
Integer
dmTTOption
As
Integer
dmCollate
As
Integer
dmFormName
As
String
*
CCFORMNAME
dmUnusedPadding
As
Integer
dmBitsPerPel
As
Integer
dmPelsWidth
As
Long
dmPelsHeight
As
Long
dmDisplayFlags
As
Long
dmDisplayFrequency
As
Long
End
Type
Private
Sub
cmdChangeDesktopMode_Click()
Dim
DM
As
DEVMODE
With
DM
.dmPelsWidth
=
CInt(txtNewWidth.Text)
.dmPelsHeight
=
CInt(txtNewHeight.Text)
.dmBitsPerPel
=
CInt(txtNewColor.Text)
.dmDisplayFrequency
=
CInt(txtNewFreq.Text)
.dmFields
=
DM_PELSWIDTH
Or
DM_PELSHEIGHT
Or
DM_BITSPERPEL
Or
DM_DISPLAYFREQUENCY
.dmSize
=
LenB(DM)
End
With
If
ChangeDisplaySettings(DM,
CDS_FORCE)
Then
MsgBox
"錯(cuò)誤!不支持此模式!"
End
If
End
Sub
Private
Sub
Form_Load()
txtOldWidth.Text
=
GetDeviceCaps(Me.hdc,
HORZRES)
txtOldHeight.Text
=
GetDeviceCaps(Me.hdc,
VERTRES)
txtOldColor.Text
=
GetDeviceCaps(Me.hdc,
BITSPIXEL)
txtOldFreq.Text
=
GetDeviceCaps(Me.hdc,
VREFRESH)
End
Sub
Dim n As Integer, b As Integer, a(13) As Integer
Private Sub Command1_Click()
If b 5 Then
b = b + 1
x = Int(n * Rnd()) + 1
Text1.Text = Text1.Text a(x) " "
a(x) = a(n)
n = n - 1
Else
Call Form_Load
End If
End Sub
Private Sub Form_Load()
Randomize
n = 13: b = 0
For i = 1 To 13
a(i) = i
Next i
Text1.Text = ""
End Sub
Public Shared Sub Randomize ([ Number ])
Randomize 用 Number 將 Rnd 函數(shù)的隨機(jī)數(shù)生成器初始化,并給它一個(gè)新的種子值。如果省略 Number,則用系統(tǒng)計(jì)時(shí)器返回的值作為新的種子值。