vb程序设计难不难
- 提问者网友:浩歌待明月
- 2021-05-13 01:04
- 五星知识达人网友:孤独的牧羊人
- 2021-05-13 02:02
VB 是Visual Basic编程语言,比易语言简单多了,只要有兴趣,学起来很容易,我叫你做一个简单的VB程序。
一个小版块,鼠标一过去就跑了。
需CommandButton一个,还要把窗体的BorderStyle属性为0
代码是:
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
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 SWP_NOMOVE = &H2
Private Const SWP_NosIZE = &H1
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim zx As Integer, zy As Integer
zx = Screen.Width / Screen.TwipsPerPixelX
zy = Screen.Height / Screen.TwipsPerPixelY
Me.Left = Int(Rnd * zx)
Me.Top = Int(Rnd * zy)
End Sub
Private Sub Form_Load()
Me.BackColor = RGB(88, 88, 88)
SetWindowPos Me.hwnd, HWND_TOPMosT, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NosIZE
Dim rtn As Long
BorderStyler = 0
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hwnd, RGB(88, 88, 88), 0, LWA_COLORKEY
End Sub
然后生成EXE文件就行了
- 1楼网友:动情书生
- 2021-05-13 07:53
VB是面向对象的可视化编程语言,是相对简单的了
应用范围也越来越小了
如果要学,建议学学其他的
- 2楼网友:大漠
- 2021-05-13 06:55
一般来讲,VB是属于自学级别的。
- 3楼网友:蕴藏春秋
- 2021-05-13 05:38
- 4楼网友:酒安江南
- 2021-05-13 04:08
- 5楼网友:酒安江南
- 2021-05-13 02:57
不难,不过是对我而言,不知道你的智商如何,总之编程的难度不是你可以想象的