Private Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As POINTAPI) As Long '全屏坐標(biāo)聲明
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長期合作伙伴,公司提供的服務(wù)項(xiàng)目有:主機(jī)域名、網(wǎng)絡(luò)空間、營銷軟件、網(wǎng)站建設(shè)、原陽網(wǎng)站維護(hù)、網(wǎng)站推廣。
Private Declare Function ScreenToClient Lib "user32.dll" (ByVal hwnd As Int32, ByRef lpPoint As POINTAPI) As Int32 '窗口坐標(biāo)聲明
Private Structure POINTAPI '聲明坐標(biāo)變量
Public x As Int32 '聲明坐標(biāo)變量為32位
Public y As Int32 '聲明坐標(biāo)變量為32位
End Structure
'以上是聲明部分
'以下是窗口部分
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick '用時(shí)鐘控件來取坐標(biāo),窗口上放個(gè)Timer組件,Enabled為允許,周期為10到100毫秒均可
Dim P As POINTAPI '聲明坐標(biāo)變量
Dim xx, yy '聲明轉(zhuǎn)換要用到的變量
GetCursorPos(P) '獲取鼠標(biāo)在屏幕中的位置
ScreenToClient(Me.Handle.ToInt32, P) '轉(zhuǎn)換為本窗體的坐標(biāo)
xx = P.x.ToString '把X轉(zhuǎn)換成能顯示到文本框的字符串格式
yy = P.y.ToString '把Y轉(zhuǎn)換成能顯示到文本框的字符串格式
TextBox1.Text = xx + "和" + yy '文本框的內(nèi)容為X坐標(biāo)和Y坐標(biāo)
End Sub
你好 那因?yàn)槟惴旁诹薒abel1控件的移動事件了 。
說明:
當(dāng)前你的代碼是在當(dāng)鼠標(biāo)經(jīng)過Label1的MouseMove事件才被激活,其他事件不備激活的。
建議應(yīng)用函數(shù)調(diào)用具體方法網(wǎng)上應(yīng)該有
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text = System.Windows.Forms.Cursor.Position.X.ToString "," System.Windows.Forms.Cursor.Position.Y.ToString
End Sub
上面代碼我是做過測試才發(fā)的,完全能實(shí)現(xiàn)你的要求?。。。。。?/p>
代碼就不寫了,給你思路,默認(rèn)左上角是原點(diǎn),所以x的位置=窗口高度-y.
這樣就獲得xy
復(fù)雜點(diǎn)的辦法是重寫繪制,繪制十字,
簡單點(diǎn)的辦法就是十字放到picbox或者image里,然后取中,然后隱藏,確定按鈕點(diǎn)擊顯示,中心位置等于坐標(biāo)點(diǎn),然后換算左上角控件位置,然后設(shè)置坐標(biāo).
很簡單,原因有二。第一,VB里long是32位,但是VB.NET里是64位,Dim ksWND As Integer才對。第二,VB在API里默認(rèn)傳址,而VB.NET默認(rèn)傳值,所以API里要添加Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long,添加"ByRef" lpRect As RECT) As Integer
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long,byref lpRect As RECT) As Integer
Private Structure RECT
Dim Left As Integer
Dim Top As Integer
Dim Right As Integer
Dim Bottom As Integer
End Structure
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim ksWND As integer
Dim ksTitle As String
Dim winS As RECT
If TextBox1.Text "" Then
ksTitle = TextBox1.Text
ksWND = FindWindow(vbNullString, ksTitle)
GetWindowRect(ksWND, winS)
MsgBox("左上角坐標(biāo)(" winS.Left "," winS.Top ")" vbCrLf "右下角坐標(biāo)(" winS.Right "," winS.Bottom ")" vbCrLf "窗口高" winS.Bottom - winS.Top "窗口寬" winS.Right - winS.Left)
Else
MsgBox("請?zhí)顚懘翱诿Q")
End If
End Sub
本文題目:nosql屬于sql,nosql包括
文章路徑:http://jinyejixie.com/article8/hojsip.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、微信公眾號、微信小程序、網(wǎng)站排名、網(wǎng)站收錄、全網(wǎng)營銷推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)