vb·net屏保代码 vbs锁屏代码

如何用VB.NET写一个简单的屏幕保护程序?

在窗体上建立2个文本框text1和text2,一个按钮command1,text1里面输入你要转换的字符串,text2里面显示结果,代码如下:

贵德ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!

Dim MyString As String

Dim EveryStr(50) As String

Dim TargetStr As String

Private Sub Command1_Click()

MyString = Text1

For i = 1 To Len(MyString)

EveryStr(i) = Right(Left(MyString, i), 1)

If Asc(EveryStr(i)) 123 And Asc(EveryStr(i)) 96 Then EveryStr(i) = \"_\"

If Asc(EveryStr(i)) 91 And Asc(EveryStr(i)) 64 Then EveryStr(i) = \"_\"

TargetStr = TargetStr EveryStr(i)

Next i

Text2 = TargetStr

TargetStr = \"\"

End Sub

引号前面怎么自动给加了个“\”?用的时候请手动把那几个“\”去掉

求VB屏保的代码....要简单的 进入(黑色)屏保後,例如只要按一下ESC就可以回到正常这样就可以了,,,,邮箱

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const HWND_TOPMOST = -1

Private Const HWND_TOP = 0

Private Const WM_SHOWWINDOW = H18

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 27 Then

Unload Me

End If

End Sub

Private Sub Form_Load()

'在属性窗口中将Form1的BorderStyle设为None

Me.BackColor = vbBlack

SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, Screen.Width, Screen.Height, WM_SHOWWINDOW

End Sub

'如果要设为屏保,需将生成的exe文件后缀改为scr,保存到system32中,并在电脑中选择此屏保

vb屏幕保护代码

'直接复制·什么都不用

Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long

Dim WithEvents Label1 As Label '在线添加一个label时的声明

Dim WithEvents Timer1 As Timer '在线添加一个timer的声明

Dim X1%, Y1%, X2%, Y2%, I%, k%, orignX, orignY, J As Boolean

Private Sub Form_Load()

Set Label1 = Me.Controls.Add("VB.Label", "Label1") '在线添加Label1控件

Set Timer1 = Me.Controls.Add("VB.Timer", "Timer1") '在线添加Timer1控件

With Me

.BorderStyle = 0

.Caption = ""

.BackColor = H0 '窗体的背景色为黑色

.FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) '窗体的填充色为随机

.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) '窗体的前景色为随机

.DrawMode = 13 '窗体输出的外观为13

.DrawWidth = 2 '窗体输出的线条宽度为2

.FillStyle = 7 '窗体的填充样式为7

.KeyPreview = True

.WindowState = 2 '窗体展开样式

.Move 0, 0, Screen.Width, Screen.Height

End With

With Label1

.Visible = True 'label可见性为true

.AutoSize = True 'label自动调整大小

.BackStyle = 0 'label背景色为透明

.Caption = "I LOVE YOU" '设置标题

.Font.Size = 60 '字体大小为60

.ForeColor = HFF00 'label前景色为黑色

'设置label的位置

.Top = Me.Height / 2 - Label1.Height / 2

.Left = Me.Width / 2 - Label1.Width / 2

End With

Timer1.Enabled = True 'timer为有效

Timer1.Interval = 10 'timer时间 间隔为0.001秒

SetCursorPos Screen.Width \ 15, 0 '将鼠标移出窗体外

orignX = Screen.Width \ 15: orignY = 0 '设置鼠标原始位置

End Sub

Private Sub Form_Activate()

I = 100: k = 100

X1 = Me.Width / 2: Y1 = Me.Height / 3

X2 = X1: Y2 = Y1

End Sub

Private Sub Form_Unload(Cancel As Integer)

Set Form1 = Nothing

End

End Sub

Private Sub Timer1_Timer()

Me.Circle (X1, Y1), 250 '在窗体上画圆

Me.Circle (X2, Y2), 250 '在窗体上画圆

If Y1 = Me.Height - 1200 Then '在指定高度运行

X1 = X1 + k: Y1 = Y1 - I

X2 = X2 - k: Y2 = Y2 - I

I = I - 2

k = IIf(Y1 = Me.Height / 3, k - 1, IIf(Y1 = Me.Height \ 3, k - 5, k))

Else

I = 100: k = 100

X1 = Me.Width / 2: Y1 = Me.Height / 3

X2 = X1: Y2 = Y1

Me.FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) '窗体的填充色为随机

Me.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255) '窗体的前景色为随机

End If

Me.DrawWidth = 3 '窗体输出的线条宽度为3

'在窗体上随机画点

Me.PSet (Rnd * Me.Width, Rnd * Me.Height), RGB(Rnd * 225, Rnd * 225, Rnd * 225)

Me.DrawWidth = 2 '窗体输出的线条宽度为2

End Sub

'在窗体上按下按键时退出程序

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode 0 Then Unload Me

End Sub

'在窗体上移动鼠标或单击鼠标时退出程序

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button 0 Or Abs(X \ 15 - orignX) = 3 Or Abs(Y \ 15 - orignY) 3 Then Unload Me

End Sub


分享题目:vb·net屏保代码 vbs锁屏代码
文章网址:http://pwwzsj.com/article/doegdoc.html