怎样制作屏幕保护程序的预览窗体?
Option Explicit
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 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 Type star
X As Long
Y As Long
speed As Long
size As Long
color As Long
End Type
Dim stars(199) As star
Const maxsize As Long = 5
Const maxspeed As Long = 25
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Unload Me
End Sub
Private Sub Form_Load()
If App.PrevInstance = True Then
End
End If
If InStr(Command, "/p") > 0 Then
ElseIf InStr(Command, "/c") > 0 Then
Form1.Show
End If
ShowCursor (False)
Dim i As Long
Randomize
For i = LBound(stars) To UBound(stars)
stars(i).X = Me.ScaleWidth * Rnd + 1
stars(i).Y = Me.ScaleHeight * Rnd + 1
stars(i).size = maxsize * Rnd + 1
stars(i).speed = maxspeed * Rnd + 1
stars(i).color = RGB(Rnd * 255 + 1, Rnd * 255 + 1, Rnd * 255 + 1)
Next i
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static currentX, currentY As Single
Dim orignX, orignY As Single
orignX = X
orignY = Y
If currentX = 0 And currentY = 0 Then
currentX = orignX
currentY = orignY
Exit Sub
End If
If Abs(orignX - currentX) > 1 Or Abs(orignY - currentY) > 1 Then
End
ShowCursor (True)
End If
End Sub
Private Sub Timer1_Timer()
Dim i As Long
BitBlt Me.hdc, 0, 0, Me.ScaleWidth, Me.ScaleHeight, 0, 0, 0, vbBlackness
For i = 0 To UBound(stars)
stars(i).Y = (stars(i).Y Mod Me.ScaleHeight) + stars(i).speed
If stars(i).Y > Me.ScaleHeight Then
stars(i).X = Me.ScaleWidth * Rnd + 1
stars(i).speed = maxspeed * Rnd + 1
End If
Me.FillColor = stars(i).color
Me.ForeColor = stars(i).color
Ellipse Me.hdc, stars(i).X, stars(i).Y, stars(i).X + stars(i).size, stars(i).Y + stars(i).size
Next i
Me.Refresh
End Sub
相关推荐
c#制作屏幕保护程序步骤(字幕屏保)
屏幕保护程序的扩展名虽然是”scr”,但其实是一个可执行的”exe”文件。但他又是一个比较独特的”exe”文件。下面就来探讨一下,用C#是如何编写屏幕保护的整个过程。 二.C#编写字幕显示屏保程序的关键步骤以及解决方法:(1)设定程序的窗体符合屏幕保护的要求:由于屏幕保护程序就是一个可执行程序,所以在编写屏幕保护程序的时候,首先按照可执行程序来设计。但屏幕保护有自身的特点。譬如:屏幕保护都是充满整个屏幕的,并且没有无边。屏幕保护运行的时候,不能显示任务栏。在程序设计中实现这些特点,关键就在于对窗体的某些属性的设定上。下面是对窗体属性的设定,就可以满足屏幕保护的要求,具体如下: 代码如下:thi
Android应用内屏幕截图功能的实现教程
在Android开发中,截图功能的实现依赖于特定的API,这些API提供了捕获屏幕内容并将其保存为图片文件的能力。MediaProjection API是Android 5.0(API Level 21)引入的一个新的截图API,它允许应用录制或捕获屏幕内容,并将其用于多种目的,如屏幕镜像、视频录制或者截图。// 示例代码:创建MediaProjection实例上述代码段展示了如何通过创建一个屏幕捕获的意图(Intent),然后启动该意图来请求用户授权。一旦用户授权,回调将提供。
用MFC制作屏幕保护程序
用MFC制作简单的屏幕保护程序 基本功能能够实现。
C#制作的屏幕保护程序
有兴趣的朋友看看,c#的屏保,含有源代码和exe,对学习图像处理的朋友很有帮助~
C#屏幕保护程序
一个用VS2010开发工具、CSharp语言写的屏幕保护程序,黑色背景的窗体加一行文本,文本随机动态显示在屏幕的任何位置,通过读取注册表来显示屏保上的文字。


VB基础类
