重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
用API函数,以下代码Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
成都创新互联云计算的互联网服务提供商,拥有超过13年的服务器租用、双线服务器托管、云服务器、网站空间、网站系统开发经验,已先后获得国家工业和信息化部颁发的互联网数据中心业务许可证。专业提供云主机、网站空间、域名申请、VPS主机、云服务器、香港云服务器、免备案服务器等。
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongPrivate Const WS_EX_LAYERED = H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = H2
Private Const LWA_COLORKEY = H1Private 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 Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_KEYDOWN = H100
Const WM_KEYUP = H101
Const WM_CHAR = H102
Const VK_F1 = H70
Private Sub SendF1(hwnd) '调用这个过程即可对目标窗体发送F1键
Call PostMessage(hwnd, WM_KEYDOWN, VK_F1, 0)
Call PostMessage(hwnd, WM_KEYUP, VK_F1, 0)
End Sub这里是发送F1的实例,各个按键对应的虚拟键码,要到网上查
可以
做中小游戏
但它有个缺点,游戏比专业软件开发的运行速度要慢
大游戏,最好使用专业游戏开发软件
新建一个Sub : Main
Private Sub Main()
xxx.show 'xxx指启动窗体
'载入图片、数据库之类的
Unload xxx
{from}.show '{from}指主界面
End Sub
然后在工程-属性将"Main"作为启动对象
假设有三张图片在资源里,VB.NET不允许资源的名字是纯数字,假设取名Image1,Image2......
Dim Images() As System.Drawing.Bitmap = {My.Resources.Image1, My.Resources.Image2, My.Resources.Image3}
Dim CurrentImage As Integer
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
If CurrentImage 2 Then CurrentImage += 1 Else CurrentImage = 0
PictureBox1.Image = Images(CurrentImage)
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If CurrentImage 0 Then CurrentImage -= 1 Else CurrentImage = 2
PictureBox1.Image = Images(CurrentImage)
End Sub
很简单啊,软糖给你代码
For i = 1 To 9999
Dim 名称 As String = String.Format("Img{0}.png", 编号) '会返回Img1.png,Img2.png...
picturebox1.Image = Bitmap.FromFile(名称)
Next
满意请采纳,谢谢。