vb移動沒有標題欄的視窗,如何移動VB中的無邊框窗體

時間 2022-03-21 13:10:13

1樓:網海1書生

這個**是vb6的,不適用於vb.net

如何移動vb中的無邊框窗體

在vb6.0中如何拖動沒有標題欄的窗體

vb中怎樣使沒有標題欄的視窗能自由移動

2樓:血刺朱雀乇

1、在mousedown事件發生時判斷按鍵狀態並獲取滑鼠位置: private sub form_mousedown(button as integer, shift as integer, x as single, y as single) '如果是滑鼠左鍵按下 if button = 1 then '標示為移動狀態 movescreen = true '得到滑鼠在窗體上的位置(相對與窗體內部座標) mousx = x mousy = y end if end sub 2、當滑鼠mousemove事件發生時,計算新的窗體座標,並移動: private sub form_mousemove(button as integer, shift as integer, x as single, y as single) '如果處於滑鼠左鍵按下的狀態,即movescreen = true時 if movescreen then '計算新的窗體座標值 currx = form1.

left - mousx + x curry = form1.top - mousy + y '移動窗體到新的位置 form1.move currx, curry end if end sub

vb 如何讓窗體既沒有標題欄,又可以在工作列中顯示標題圖示等。

3樓:風雪劍無痕

'怎麼不解決呢?雖然顯示了,但沒有常見的右鍵選單以及選單功能,解決一下

'新增乙個模組,加入以下**

option explicit

private declare function callwindowproc lib "user32" alias "callwindowproca" (byval lpprevwndfunc as long, byval hwnd as long, byval msg as long, byval wparam as long, byval lparam as long) as long

private declare function releasecapture lib "user32" () as long

private declare function sendmessage lib "user32" alias "sendmessagea" (byval hwnd as long, byval wmsg as long, byval wparam as long, lparam as any) as long

public declare function getwindowlong lib "user32" alias "getwindowlonga" (byval hwnd as long, byval nindex as long) as long

public declare function setwindowlong lib "user32" alias "setwindowlonga" (byval hwnd as long, byval nindex as long, byval dwnewlong as long) as long

private const wm_close = &h10

public loldproc as long

'處理一些訊息

public function wndproc(byval hwnd as long, byval msg as long, byval wparam as long, byval lparam as long) as long

select case msg

case wm_syscommand

'使無邊框窗體系統選單的關閉按鈕有效

if wparam = sc_close then

sendmessage hwnd, wm_close, byval 0&, byval 0&

end if

end select

wndproc = callwindowproc(loldproc, hwnd, msg, wparam, lparam)

end function

'移動無邊框窗體,可用於任意控制項的滑鼠按下事件裡

public sub dragform(frm as form)

releasecapture

call sendmessage(frm.hwnd, wm_nclbuttondown, 2, 0&)

end sub

'窗體載入事件

'使無邊框窗體獲得系統選單

private sub form_load()

dim lstyle&

lstyle = getwindowlong(me.hwnd, -16)

setwindowlong me.hwnd, -16, lstyle

loldproc = setwindowlong(me.hwnd, -4, addressof wndproc)

end sub

solidworks工程圖的標題欄如何輸入

蓋健魏河 在左手邊樹下右鍵圖紙格式,選編輯圖紙格式,就可以操作標題欄了。如何快速填寫solidworks工程圖的標題欄? 在零件或裝配體裡的屬性裡先把對應的專案輸入進去,生成工程圖時就自動填寫了。不過最好是自己做好專用的工程圖模板儲存好,使用起來方便點。solidworks工程圖的標題欄如何輸入? ...

vb中label的屬性欄caption中輸入的文字如何使它換行,本人還

二樓簡單,如果想靈活的設定換行位置,可以這樣 abcdef 改為 abc vbcrlf def 直接在屬性欄裡輸入你把label尺寸拉小自然就換行了 在程式內你這樣寫例如label1.caption 11111 vbcrlf 22222 就換行了 什麼也不用設定,在記事本寫好文字,複製,copy 到...

vb中如何定義數的取值範圍,VB中如何定義一個數的取值範圍??

vb中定義一個數的取值範圍可以通過條件判斷來實現。比如 設定a取值範圍 100 999,則 如下 if a 100 and a 999 then 判斷是否在100 999區間內 在區間內寫相應 else 不在區間內寫相應的 end if 灰原哀柯南君蘭 這涉及到資料的處理,一般地我們運用數值型函式給...