真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net運動控制 C#運動控制

用VB.NET運行雷賽運動控制卡時找不到指定的模塊是需要加什么參數(shù)保存地址嗎

是新建項目,也叫工程。

成都創(chuàng)新互聯(lián)公司長期為千余家客戶提供的網(wǎng)站建設(shè)服務(wù),團隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為召陵企業(yè)提供專業(yè)的網(wǎng)站設(shè)計制作、成都網(wǎng)站建設(shè),召陵網(wǎng)站改版等技術(shù)服務(wù)。擁有十多年豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。

再添加模塊。

以前的VB6里面叫工程。

如何在VB.net中用程序控制鼠標移動和點擊

調(diào)用api

在Visual Baisc.net中的聲明:

Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Public Const MOUSEEVENTF_LEFTDOWN = H2 '模擬鼠標左鍵按下

Public Const MOUSEEVENTF_LEFTUP = H4 ’模擬鼠標左鍵釋放

Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模擬鼠標中間鍵按下

Public Const MOUSEEVENTF_MIDDLEUP = H40 '模擬鼠標中間鍵釋放

Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模擬鼠標右鍵按下

Public Const MOUSEEVENTF_RIGHTUP = H10 '模擬鼠標右鍵釋放

Public Const MOUSEEVENTF_MOVE = H1 '模擬鼠標指針移動

例:

mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0

'在(10,10)模擬鼠標左鍵按下

vb.net編寫的貪吃蛇游戲,帶代碼的

需用VB實現(xiàn),代碼如下

'定義蛇的運動速度枚舉值

Private Enum tpsSpeed

QUICKLY = 0

SLOWLY = 1

End Enum

'定義蛇的運動方向枚舉值

Private Enum tpsDirection

D_UP = 38

D_DOWN = 40

D_LEFT = 37

D_RIGHT = 39

End Enum

'定義運動區(qū)域4個禁區(qū)的枚舉值

Private Enum tpsForbiddenZone

FZ_TOP = 30

FZ_BOTTOM = 5330

FZ_LEFT = 30

FZ_RIGHT = 5730

End Enum

'定義蛇頭及身體初始化數(shù)枚舉值

Private Enum tpsSnake

SNAKEONE = 1

SNAKETWO = 2

SNAKETHREE = 3

SNAKEFOUR = 4

End Enum

'定義蛇寬度的常量

Private Const SNAKEWIDTH As Integer = 100

'該過程用于顯示游戲信息

Private Sub Form_Load()

Me.Show

Me.lblTitle = "BS貪食蛇 — (版本 " App.Major "." App.Minor "." App.Revision ")"

Me.Caption = Me.lblTitle.Caption

frmSplash.Show 1

End Sub

'該過程用于使窗體恢復(fù)原始大小

Private Sub Form_Resize()

If Me.WindowState 1 Then

Me.Caption = ""

Me.Height = 6405 '窗體高度為 6405 緹

Me.Width = 8535 '窗體寬度為 8535 緹

Me.Left = (Screen.Width - Width) \ 2

Me.Top = (Screen.Height - Height) \ 2

End If

End Sub

'該過程用于重新開始開始游戲

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

Beep

msg = MsgBox("您確認要重新開始游戲嗎?", 4 + 32, "BS貪食蛇")

If msg = 6 Then Call m_subGameInitialize

End Sub

'該過程用于暫停/運行游戲

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

If Me.chkPause.Caption = "暫停游戲(P)" Then

Me.tmrSnakeMove.Enabled = False

Me.tmrGameTime.Enabled = False

Me.picMoveArea.Enabled = False

Me.lblPauseLab.Visible = True

Me.chkPause.Caption = "繼續(xù)游戲(R)"

Else

Me.tmrSnakeMove.Enabled = True

Me.tmrGameTime.Enabled = True

Me.picMoveArea.Enabled = True

Me.lblPauseLab.Visible = False

Me.chkPause.Caption = "暫停游戲(P)"

End If

End Sub

'該過程用于顯示游戲規(guī)則

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

Beep

MsgBox " BS貪食蛇:一個規(guī)則最簡單的趣味游戲,您將用鍵盤" Chr(13) _

"上的4個方向鍵來控制蛇的運動方向。在運動過程中蛇" Chr(13) _

"不能后退,蛇的頭部也不能接觸到運動區(qū)域的邊線以外" Chr(13) _

"和蛇自己的身體,否則就游戲失敗。在吃掉隨機出現(xiàn)的" Chr(13) _

"果子后,蛇的身體會變長,越長難度越大。祝您好運??!", 0 + 64, "游戲規(guī)則"

End Sub

'該過程用于顯示游戲開發(fā)信息

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

Beep

MsgBox "BS貪食蛇" "(V-" App.Major "." App.Minor "版本)" Chr(13) Chr(13) _

"" Chr(13) Chr(13) _

"由PigheadPrince設(shè)計制作" Chr(13) _

"CopyRight(C)2002,BestSoft.TCG", 0, "關(guān)于本游戲"

End Sub

'該過程用于退出游戲

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

Beep

msg = MsgBox("您要退出本游戲嗎?", 4 + 32, "BS貪食蛇")

Select Case msg

Case 6

End

Case 7

Me.chkWindowButton(2).Value = 0

Exit Sub

End Select

End Sub

'該過程用于拖動窗體_(點擊圖標)

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

ReleaseCapture

SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MOVE, 0

End Sub

'該共用過程用于處理窗體控制按鈕組的相關(guān)操作_(鎖定、最小化、退出)

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

If Button 1 Then Exit Sub

Select Case Index

Case 0 '鎖定窗體

If Me.chkWindowButton(0).Value = 1 Then

Me.imgWindowTop.BorderStyle = 0

Me.imgWindowTop.Enabled = False

Else

Me.imgWindowTop.BorderStyle = 1

Me.imgWindowTop.Enabled = True

End If

Case 1 '最小化

Me.WindowState = 1

Me.chkWindowButton(1).Value = 0

Me.Caption = "BS貪食蛇 — (V-" App.Major "." App.Minor "版本)"

Case 2 '退出

Beep

msg = MsgBox("您要退出本游戲嗎?", 4 + 32, "BS貪食蛇")

Select Case msg

Case 6

End

Case 7

Me.chkWindowButton(2).Value = 0

Exit Sub

End Select

End Select

End Sub

'該過程用于設(shè)置蛇運動速度的快慢

Private Sub hsbGameSpeed_Change()

Me.tmrSnakeMove.Interval = Me.hsbGameSpeed.Value

End Sub

'該過程用于通過鍵盤的方向鍵改變蛇的運動方向

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

Select Case g_intDirection

Case D_UP

If KeyCode = D_DOWN Then Exit Sub

Case D_DOWN

If KeyCode = D_UP Then Exit Sub

Case D_LEFT

If KeyCode = D_RIGHT Then Exit Sub

Case D_RIGHT

If KeyCode = D_LEFT Then Exit Sub

End Select

g_intDirection = KeyCode

End Sub

'該計時循環(huán)過程用于計算游戲耗費的秒數(shù)并顯示

Private Sub tmrGameTime_Timer()

g_lngGameTime = g_lngGameTime + 1

Me.lblGameTime.Caption = g_lngGameTime "秒"

End Sub

'該計時循環(huán)過程用于控制蛇的行動軌跡

Private Sub tmrSnakeMove_Timer()

Dim lngSnakeX As Long, lngSnakeY As Long, lngSnakeColor As Long

Dim lngPointX As Long, lngPointY As Long, lngPointColor As Long

Randomize

Me.picMoveArea.SetFocus

Me.picMoveArea.Cls

'確認蛇頭的運動方向并獲取新的位置

Select Case g_intDirection

Case D_UP '向上運動

g_udtSnake(SNAKEONE).Snake_CurX = g_udtSnake(SNAKEONE).Snake_OldX

g_udtSnake(SNAKEONE).Snake_CurY = g_udtSnake(SNAKEONE).Snake_OldY

g_udtSnake(SNAKEONE).Snake_CurY = g_udtSnake(SNAKEONE).Snake_CurY - SNAKEWIDTH

Case D_DOWN '向下運動

g_udtSnake(SNAKEONE).Snake_CurX = g_udtSnake(SNAKEONE).Snake_OldX

g_udtSnake(SNAKEONE).Snake_CurY = g_udtSnake(SNAKEONE).Snake_OldY

g_udtSnake(SNAKEONE).Snake_CurY = g_udtSnake(SNAKEONE).Snake_CurY + SNAKEWIDTH

Case D_LEFT '向左運動

g_udtSnake(SNAKEONE).Snake_CurX = g_udtSnake(SNAKEONE).Snake_OldX

g_udtSnake(SNAKEONE).Snake_CurX = g_udtSnake(SNAKEONE).Snake_CurX - SNAKEWIDTH

g_udtSnake(SNAKEONE).Snake_CurY = g_udtSnake(SNAKEONE).Snake_OldY

Case D_RIGHT '向右運動

g_udtSnake(SNAKEONE).Snake_CurX = g_udtSnake(SNAKEONE).Snake_OldX

g_udtSnake(SNAKEONE).Snake_CurX = g_udtSnake(SNAKEONE).Snake_CurX + SNAKEWIDTH

g_udtSnake(SNAKEONE).Snake_CurY = g_udtSnake(SNAKEONE).Snake_OldY

End Select

'根據(jù)新的位置繪制蛇頭

lngSnakeX = g_udtSnake(SNAKEONE).Snake_CurX

lngSnakeY = g_udtSnake(SNAKEONE).Snake_CurY

lngSnakeColor = g_udtSnake(SNAKEONE).Snake_Color

Me.picMoveArea.PSet (lngSnakeX, lngSnakeY), lngSnakeColor

'移動蛇身體其他部分的位置

For i = 2 To g_intSnakeLength

g_udtSnake(i).Snake_CurX = g_udtSnake(i - 1).Snake_OldX

g_udtSnake(i).Snake_CurY = g_udtSnake(i - 1).Snake_OldY

lngSnakeX = g_udtSnake(i).Snake_CurX

lngSnakeY = g_udtSnake(i).Snake_CurY

lngSnakeColor = g_udtSnake(i).Snake_Color

Me.picMoveArea.PSet (lngSnakeX, lngSnakeY), lngSnakeColor

Next i

'更新蛇舊的坐標位置

For j = 1 To g_intSnakeLength

g_udtSnake(j).Snake_OldX = g_udtSnake(j).Snake_CurX

g_udtSnake(j).Snake_OldY = g_udtSnake(j).Snake_CurY

Next j

'判斷蛇在移動中是否到了禁區(qū)而導(dǎo)致游戲失敗

If m_funMoveForbiddenZone(g_udtSnake(SNAKEONE).Snake_CurX, g_udtSnake(SNAKEONE).Snake_CurY) Then

Beep

MsgBox "您的蛇移動到了禁區(qū),游戲失??!", 0 + 16, "BS貪食蛇"

Me.tmrSnakeMove.Enabled = False

Me.tmrGameTime.Enabled = False

Me.picMoveArea.Visible = False

Exit Sub

End If

'判斷蛇在移動中是否碰到了自己的身體而導(dǎo)致游戲失敗

If m_funTouchSnakeBody(g_udtSnake(SNAKEONE).Snake_CurX, g_udtSnake(SNAKEONE).Snake_CurY) Then

Beep

MsgBox "您的蛇在移動中碰到了自己的身體,游戲失敗!", 0 + 16, "BS貪食蛇"

Me.tmrSnakeMove.Enabled = False

Me.tmrGameTime.Enabled = False

Me.picMoveArea.Visible = False

Exit Sub

End If

'判斷蛇是否吃到了果子

If m_funEatPoint(g_udtSnake(SNAKEONE).Snake_CurX, g_udtSnake(SNAKEONE).Snake_CurY) Then

'累加玩家的得分并刷新得分顯示

g_intPlayerScore = g_intPlayerScore + 1

Me.lblYourScore.Caption = g_intPlayerScore "分"

Call m_subAddSnake '加長蛇的身體

Call m_subGetPoint '獲取下一個果子的位置和顏色

Else

'繪制果子

lngPointX = g_udtPoint.Point_X

lngPointY = g_udtPoint.Point_Y

lngPointColor = g_udtPoint.Point_Color

Me.picMoveArea.PSet (lngPointX, lngPointY), lngPointColor

End If

End Sub

'該私有子過程用于初始化游戲

Private Sub m_subGameInitialize()

Erase g_udtSnake '清空蛇的結(jié)構(gòu)數(shù)組

g_intPlayerScore = 0 '清空玩家的得分

g_lngGameTime = 0 '清空游戲耗費的秒數(shù)

g_intDirection = D_DOWN '設(shè)定蛇的初始運動方向為下

g_intSnakeLength = 4 '設(shè)定蛇的初始長度

ReDim g_udtSnake(1 To g_intSnakeLength) '重新定義蛇的長度

'定義蛇頭部的數(shù)據(jù)

With g_udtSnake(SNAKEONE)

.Snake_OldX = 530

.Snake_OldY = 530

.Snake_Color = vbBlack

End With

'定義蛇身第2節(jié)的數(shù)據(jù)

With g_udtSnake(SNAKETWO)

.Snake_OldX = 530

.Snake_OldY = 430

.Snake_Color = vbGreen

End With

'定義蛇身第3節(jié)的數(shù)據(jù)

With g_udtSnake(SNAKETHREE)

.Snake_OldX = 530

.Snake_OldY = 330

.Snake_Color = vbYellow

End With

'定義蛇身第4節(jié)的數(shù)據(jù)

With g_udtSnake(SNAKEFOUR)

.Snake_OldX = 530

.Snake_OldY = 230

.Snake_Color = vbRed

End With

Me.picMoveArea.Visible = True

Me.lblYourScore.Caption = g_intPlayerScore "分"

Me.lblGameTime.Caption = g_lngGameTime "秒"

Me.tmrSnakeMove.Interval = Me.hsbGameSpeed.Value

Me.tmrSnakeMove.Enabled = True

Me.tmrGameTime.Enabled = True

Call m_subGetPoint '獲取第一個果子的位置和顏色

End Sub

我有些VB基礎(chǔ),我想買個4軸運動控制卡并且用vb.net做專用特色控制系統(tǒng)。

用vb.net完全沒有問題,挺簡單的,包括常用的插補功能,關(guān)鍵是板卡要提供vb.net的SDK,常有的研華,雷賽等都支持vb.net

運動控制卡和plc比較有什么不同

運動控制卡與PLC都是控制器,主要負責(zé)工業(yè)自動化系統(tǒng)中運動軸控制、輸入輸出信號控制;

運動控制卡:基于PC界面,由于PC機的強大功能,因此與其一起組成的運動控制器功能最強,但其工作穩(wěn)定性、可靠性較差。運動控制卡通過PCI插槽將控制卡插在PC的主機上;利用高級編程語言C++、C#、VB、VB.NET、labview等編程語言進行開發(fā);編程中使用運動控制卡廠商提供的控制卡API接口函數(shù),來實現(xiàn)對控制卡資源的使用;運動控制卡通過發(fā)送脈沖的方式控制伺服或步進驅(qū)動器來控制伺服電機或步進電機、通過讀取輸入信號、控制輸出信號來實現(xiàn)對繼電器、傳感器、氣缸等IO的控制;運動控制卡主要的優(yōu)勢在于利用PC強大的功能,比如CAD功能、機器視覺功能、軟件高級編程等;利用FPGA+DSP / ARM + DSP芯片的功能實現(xiàn)高精度的運動控制(多軸直線、圓弧插補等,運動跟隨,PWM控制等)。

PLC可編程邏輯控制器:主要功能是對開關(guān)量進行邏輯控制,并有簡單的運動控制(直線軌跡控制)、運算、數(shù)據(jù)處理等功能,通常采用觸摸屏作人機界面。具有工作可靠,編程簡單等優(yōu)點,但其運動控制功能相對簡單。PLC的應(yīng)用過程中主要通過PLC+HMI,這就導(dǎo)致可視化界面受到極大地限制,實際應(yīng)用過程中最大的問題就是不能實現(xiàn)導(dǎo)圖功能;現(xiàn)在由于機器視覺大力的發(fā)展與應(yīng)用,PLC與機器視覺的結(jié)合難度很大;目前有部分廠商給PLC提供一種機器視覺方案,獨立的PC機處理視覺部分,將處理的結(jié)果發(fā)送給PLC,PLC來應(yīng)用所接收數(shù)據(jù)進行操作。這種方式提高了開發(fā)成本,一套控制系統(tǒng)需要兩套軟件來執(zhí)行。


網(wǎng)站欄目:vb.net運動控制 C#運動控制
鏈接URL:http://weahome.cn/article/hhcees.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部