110,539
社区成员
发帖
与我相关
我的任务
分享
Public Class Form1
Private 背景 As Bitmap = Nothing
Private 播放帧 As Integer = 0
Private 向后播放 As Boolean = True
Private 停止播放 As Boolean = False
Private 背景大小 As Size
Private 文字层 As New DSAPI.图形图像.彩色文字图像
Private 进度值 As Integer = 0
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
停止播放 = True
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Me.DoubleBuffered = True
背景大小 = My.Resources.V.Size
Me.Size = My.Resources.V.Size
DSAPI.图形图像.透明窗体.显示图像(Me, My.Resources.V, 255)
DSAPI.图形图像.透明窗体.窗体支持鼠标拖动(Me, True)
'--初始化文字渲染引擎
With 文字层
.画布尺寸 = 背景大小
.字体 = New Font("微软雅黑", 18)
.绘制描边 = True
.描边颜色 = Color.Black
.绘制阴影 = True
.阴影颜色 = Color.Black
.文字清晰度 = Drawing.Text.TextRenderingHint.AntiAlias
.文字颜色 = Color.White
End With
CheckForIllegalCrossThreadCalls = False
Dim T As New Threading.Thread(AddressOf 播放动画)
T.Start()
End Sub
Private Sub 播放动画()
Try
While 停止播放 = False
If 向后播放 Then
播放帧 += 2
If 播放帧 > 60 Then
向后播放 = False
End If
Else
播放帧 -= 2
If 播放帧 < 0 Then
向后播放 = True
End If
End If
创建背景()
Threading.Thread.Sleep(30)
End While
Catch
End Try
End Sub
Private Sub 创建背景()
Try
背景 = Nothing
背景 = New Bitmap(背景大小.Width, 背景大小.Height)
Using G As Graphics = Graphics.FromImage(背景)
'---绘制光线层
Dim Rct As Rectangle = New Rectangle(播放帧, 播放帧, 背景大小.Width - 播放帧 * 2, 背景大小.Height - 播放帧 * 2)
G.DrawImage(My.Resources._1, Rct, New Rectangle(0, 0, 背景大小.Width, 背景大小.Height), GraphicsUnit.Pixel)
'---绘制前景层
G.DrawImage(My.Resources.V, New Rectangle(0, 0, 背景大小.Width, 背景大小.Height), New Rectangle(0, 0, 背景大小.Width, 背景大小.Height), GraphicsUnit.Pixel)
'---绘制文字层
Try
Dim Img As Bitmap = 文字层.输出图像
If Img IsNot Nothing Then
G.DrawImage(Img, New Rectangle(Me.Width / 3, Me.Height - 100, Img.Width, Img.Height), New Rectangle(0, 0, Img.Width, Img.Height), GraphicsUnit.Pixel)
End If
Catch
End Try
End Using
DSAPI.图形图像.透明窗体.显示图像(Me, 背景, 255)
Catch
End Try
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
进度值 += 1
If 进度值 > 100 Then 进度值 = 0
文字层.代码文本 = "<color=255,255,255>载入进度:</color><color=100,255,0><b>" & 进度值 & "%</b></color>"
End Sub
End Class