当前位置:首页 » 编程软件 » 编程vb实例

编程vb实例

发布时间: 2024-03-22 22:49:45

㈠ VB.NET 拖动无边框窗体编程实例

Imports System Drawing Imports System Windows Forms 裂搭手 ****************************************** Private oOriginalRegion As Region = Nothing 用于窗体移动 Private bFormDragging As Boolean = False Private oPointClicked As Point ****************************************** Private Sub Form _MouseDown(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseDown Me bFormDragging = True Me oPointClicked = New Point(e X e Y) End Sub ****************************************** Private Sub Form _MouseUp(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseUp Me bFormDragging = False End Sub ****************************************** Private Sub Form _MouseMove(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseMove If Me bFormDragging Then Dim oMoveToPoint As Point 以当前鼠标肆嫌位置为基础 找出目标位置 oMoveToPoint = Me PointToScreen(New Point(e X e Y)) 枝兄 根据开始位置作出调整 oMoveToPoint Offset(Me oPointClicked X * _ (Me oPointClicked Y + _ SystemInformation CaptionHeight + _ SystemInformation BorderSize Height) * ) 移动窗体 Me Location = oMoveToPoint End If

lishixin/Article/program/ASP/201311/21755

㈡ vb编程例题

PrivateSubCommand1_Click()
Dima(10)AsInteger,xAsInteger
Randomize
Fori=1To10
a(i)=Int(Rnd()*51)
Printa(i);
Nexti
Print
x=InputBox("请输入一个数:")
Fori=1To10
Ifa(i)=xThenExitFor
Nexti
Ifi<11Then
Print"a(";i;")=";x
Else
Print"未找到";x
EndIf
EndSub

㈢ 求一个简单vb编程实例~

控件:image,picture,timer代码:Dim x As Integer
Dim y As IntegerPrivate Sub Form_Load()
x = 100
y = 100
Timer1.Interval = 100
End SubPrivate Sub Timer1_Timer()
If img.Top >= pic.Height - img.Height Then
y = -100
End If
If img.Top <= 0 Then
y = 100
End If
If img.Left >= pic.Width - img.Width Then
x = -100
End If
If img.Left <= 0 Then
x = 100
End If
img.Top = img.Top + y
img.Left = img.Left + x
End Sub
以上代码实现的是图片框中的一个小球做的规律的运动,当小球碰到图片框边缘时便反弹继续运动

热点内容
access数据库表的创建 发布:2024-11-15 18:51:18 浏览:140
怎么搭建信令服务器 发布:2024-11-15 18:48:03 浏览:577
如何解锁安卓手机锁屏图 发布:2024-11-15 18:47:48 浏览:965
c语言水仙花数编程 发布:2024-11-15 18:45:50 浏览:851
安卓快手伴侣悬浮怎么设置 发布:2024-11-15 18:26:50 浏览:523
浏览器缓存好的视频为什么都删了 发布:2024-11-15 18:23:06 浏览:160
睡眠缓解压力 发布:2024-11-15 18:20:02 浏览:433
什么是统一存储 发布:2024-11-15 18:19:02 浏览:514
b01智能锁出厂密码是什么 发布:2024-11-15 18:11:01 浏览:677
解压密码提示在哪里 发布:2024-11-15 18:09:31 浏览:598