新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
是我以前自己设计的用来测试自己点钞速度用的,希望是你需要的
10年积累的成都网站建设、做网站经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先建设网站后付款的网站建设流程,更有比如免费网站建设让你可以放心的选择与我们合作。
以下是窗体的全部代码
Public Class Form1
Dim StartFlag As Boolean = False
Dim secon As Integer
Dim minut As Integer
'空格
Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
If e.KeyCode = Keys.Space Then
If StartFlag Then
StartFlag = False
Timer1.Enabled = False
If Val(Strings.Right(Label1.Text, 2)) 10 And Val(Strings.Right(Label1.Text, 2)) = 0 Then secon = 0 : minut = 0 : Label1.Text = "00:00" : Exit Sub
ListBox1.Items.Add(Label1.Text.ToString)
ListBox1.SelectedItem = ListBox1.Items.Count - 1
Label1.Focus()
Button1.Enabled = True
Label1.Text = "00:00"
secon = 0
minut = 0
Else
StartFlag = True
Timer1.Enabled = True
End If
End If
End Sub
'加载
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Clear()
Label1.Text = "00:00"
Button1.Enabled = False
secon = 0
minut = 0
Label1.Focus()
End Sub
'清空
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button1.Enabled = False
ListBox1.Items.Clear()
Label1.Focus()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
secon += 1
If secon = 60 Then
secon = 0
minut += 1
End If
Dim seconStr As String = secon
If seconStr.Length = 1 Then seconStr = "0" + seconStr
Dim minutStr As String = minut
If minutStr.Length = 1 Then minutStr = "0" + minutStr
Label1.Text = minutStr + ":" + seconStr
Label1.Focus()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SeconSun As Integer
If ListBox1.Items.Count 0 Then
For i = 0 To ListBox1.Items.Count - 1
Dim TemStr As String = ListBox1.Items.Item(i).ToString
Dim TemInt1 As Integer = Val(Strings.Right(TemStr, 2))
Dim TemInt2 As Integer = Val(Strings.Left(TemStr, 2))
Debug.Print(TemInt1.ToString)
Debug.Print(TemInt2.ToString)
SeconSun += TemInt1 + TemInt2 * 60
Debug.Print(SeconSun.ToString)
Next
TextBox1.Text = (SeconSun / ListBox1.Items.Count).ToString + "秒"
End If
Label1.Focus()
End Sub
End Class
分析:
添加一个新窗体,设置属性.TopMost=True ,窗体显示在前面。
设置一下透明度增加效果。如果使用窗体闪烁,可以添加时间控件,
设置时间段变更窗体透明度来达到你想要的效果。
DataGridView控件,放一个DataGridView1和Button1到窗体,下面是按钮下代码\x0d\x0a Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click\x0d\x0a Me.DataGridView1.AllowUserToAddRows = False\x0d\x0a DataGridView1.RowTemplate.Height = 200\x0d\x0a DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None\x0d\x0a For i = 1 To 3\x0d\x0a Me.DataGridView1.Columns.Add("列" i.ToString, "列" i.ToString)\x0d\x0a Me.DataGridView1.Rows.Add()\x0d\x0a Next\x0d\x0a Me.DataGridView1.Columns(0).Width = 100\x0d\x0a Me.DataGridView1.Columns(1).Width = 500\x0d\x0a Me.DataGridView1.Columns(0).Width = 300\x0d\x0a End Sub\x0d\x0a'自己设置相关需要的属性即可
你需要会用GDI+,也就是那个System.Drawing命名空间下的类.
给你说个思路,设Timer,到时间就用Form.Invalidate()函数重画窗口,在重画窗口的Form_Paint事件下面编写代码得到当前时间,再根据当前时间用GDI+画时钟.