vb有没有像flash翻书效果的那种控件或源代码?
如题
[解决办法]
有的话,发我一个。
[解决办法]
没有自带的,可以找第三方控件
[解决办法]
干脆使用flash得了
[解决办法]
代码,需要加一个PictureBox(Picture1)和一个Timer(Timer1):
Option Explicit
Private Declare Function Polygon Lib "gdi32 " (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Declare Function BitBlt Lib "gdi32 " (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function PlgBlt Lib "gdi32 " (ByVal hdcDest As Long, lpPoint As POINTAPI, ByVal hdcSrc As Long, ByVal nXSrc As Long, ByVal nYSrc As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hbmMask As Long, ByVal xMask As Long, ByVal yMask As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Dim MaxL As Long
Private Sub Form_Load()
Timer1.Interval = 1
Me.ScaleMode = 3
Picture1.ScaleMode = 3
Picture1.AutoRedraw = True
Picture1.BackColor = vbWhite
Me.AutoRedraw = True
Picture1.BorderStyle = 0
Picture1.Visible = False
Me.Picture = Picture1.Picture
Me.ForeColor = Me.BackColor
Me.FillColor = Me.BackColor
Me.FillStyle = 0 'Solid
Me.Width = Me.Width - Me.ScaleWidth * 15 + Picture1.Width * 15
Me.Height = Me.Height - Me.ScaleHeight * 15 + Picture1.Height * 15
MaxL = IIf(Picture1.Width < Picture1.Height, Picture1.Height, Picture1.Width) * 2
Picture1.Width = MaxL
Picture1.Height = MaxL
Me.Line (MaxL, 0)-(MaxL, MaxL + 1), 0
Me.Line (0, MaxL)-(MaxL + 1, MaxL), 0
Me.Picture = Me.Image
End Sub
Private Sub Timer1_Timer()
Dim p(5) As POINTAPI
Dim j%
Static i%
i = i + 8 '扩大范围
Me.Cls
'****画水平、垂直翻转的正方形↓
p(0).x = i '--原来的左上角,变成了右下角
p(0).y = i '_/
p(1).x = i '--右上角
p(1).y = 0 '_/
p(2).x = 0 '--左下角
p(2).y = i '_/
PlgBlt Me.hdc, p(0), Picture1.hdc, 0, 0, i, i, 0, 0, 0
'******************************
'******************画空白部分↓
p(0).x = 0
p(0).y = 0
p(1).x = 0
p(1).y = i
p(2).x = i / 3 - 10
p(2).y = i / 3 * 2 - 10
p(3).x = i / 2 - 12
p(3).y = i / 2 - 12
p(4).x = i / 3 * 2 - 10
p(4).y = i / 3 - 10
p(5).x = i
p(5).y = 0
If i > = MaxL Then Timer1.Enabled = False
Polygon Me.hdc, p(0), 6
'******************************
'******************画曲线图形↓
For j = 10 To Int(i / 16) Step 1
BitBlt Me.hdc, i - (Int(i / 16 + 1) - j), i / 2 - j * i / 20, 1, j * i / 10, Picture1.hdc, i - (Int(i / 16 + 1) - j), i / 2 - j * i / 20, vbSrcCopy
Next j
For j = 10 To Int(i / 16) Step 1
BitBlt Me.hdc, i / 2 - j * i / 20, i - (Int(i / 16 + 1) - j), j * i / 10, 1, Picture1.hdc, i / 2 - j * i / 20, i - (Int(i / 16 + 1) - j), vbSrcCopy
Next j
'******************************
Me.Refresh
End Sub
[解决办法]
看看画透明图片的方法,对一个图片来操作,实现的效果和代码可读性都应该更好.