'''?summary多屏顯示屏幕設置/summary
科爾沁右翼前網站制作公司哪家好,找成都創新互聯公司!從網頁設計、網站建設、微信開發、APP開發、響應式網站設計等網站項目制作,到程序開發,運營維護。成都創新互聯公司2013年開創至今到現在10年的時間,我們擁有了豐富的建站經驗和運維經驗,來保證我們的工作的順利進行。專注于網站建設就選成都創新互聯公司。
'''?param?name="obj"目標窗體/param
'''?param?name="scrIndex"由0開始的屏幕索引,0為主屏幕/param
Private?Sub?ShowScreens(obj?As?Form,?scrIndex?As?Integer)
Dim?arr?As?Screen()?=?Screen.AllScreens
If?scrIndex??arr.Length?Then
obj.Left?+=?arr(scrIndex).Bounds.X
Else
Dim?mess?As?String?=?"當前屏幕索引超出范圍,是否要顯示在最后一個屏幕?"
Dim?result?As?DialogResult?=?_
MessageBox.Show(mess,?"信息提示",?_
MessageBoxButtons.YesNo,?MessageBoxIcon.Warning)
If?result?=?Windows.Forms.DialogResult.Yes?Then?_
obj.Left?+=?arr(arr.Length?-?1).Bounds.X
End?Sub
多屏幕的顯示,屏幕的寬度相當等于N屏幕的寬度之和,更改窗體的X坐標就能控制窗體顯示在哪個屏幕上。
兩個顯示器顯示有兩種模式,一種是
雙屏
復制,另一種是擴展。
你這個只能用第二種方式。你需要把要在另一個顯示器上顯示的窗體的Location設置在主顯示器全屏時的右邊就可以了.其實就是桌面的向右延伸。
在主顯示上拖一下窗體就明白了!
在項目中右鍵點擊添加窗體。在代碼中需要顯示該窗體的地方寫入如下代碼:“form2.show()”form2是你窗體的name屬性……
我做了幾行。
對無標題欄的窗體,或者不從標題欄移動的情況下可用。
有標題欄并且點住標題欄移動則不理想。
代碼如下,僅供參考。
1、建立模塊。
option
explicit
public
oldproc
as
long
public
declare
function
setwindowlong
lib
"user32"
alias
"setwindowlonga"
(byval
hwnd
as
long,
byval
nindex
as
long,
byval
dwnewlong
as
long)
as
long
public
declare
function
sendmessage
lib
"user32"
alias
"sendmessagea"
(byval
hwnd
as
long,
byval
wmsg
as
long,
byval
wparam
as
long,
byref
lparam
as
any)
as
long
public
declare
function
callwindowproc
lib
"user32"
alias
"callwindowproca"
(byval
lpprevwndfunc
as
long,
byval
hwnd
as
long,
byval
msg
as
any,
byval
wparam
as
any,
byval
lparam
as
any)
as
long
public
const
wm_move
=
h3
public
const
wm_lbuttondown
=
h201
public
const
wm_lbuttonup
=
h202
public
const
gwl_wndproc
=
(-4)
public
bnhwnd
as
long
public
function
newproc(byval
hwnd
as
long,
byval
msg
as
long,
byval
wp
as
long,
byval
lp
as
long)
as
long
if
msg
=
wm_move
then
'捕獲窗體移動事件
sendmessage
bnhwnd,
wm_lbuttondown,
1,
sendmessage
bnhwnd,
wm_lbuttonup,
1,
'將消息發送到按紐,使其發生click事件
end
if
newproc
=
callwindowproc(oldproc,
hwnd,
msg,
wp,
lp)
end
function
2、在窗體上有一個按鈕(名稱為eventbn)
dim
原垂直
as
single,
原水平
as
single
private
sub
eventbn_click()
msgbox
"移動了"
end
sub
private
sub
form_load()
form2.show
form3.show
bnhwnd
=
eventbn.hwnd
'獲得按紐句丙
oldproc
=
setwindowlong(me.hwnd,
gwl_wndproc,
addressof
newproc)
eventbn.visible
=
false
end
sub
private
sub
form_mousedown(button
as
integer,
shift
as
integer,
x
as
single,
y
as
single)
if
button
=
1
then
原垂直
=
me.top
+
y
原水平
=
me.left
+
x
end
if
end
sub
private
sub
form_mouseup(button
as
integer,
shift
as
integer,
x
as
single,
y
as
single)
me.top
=
me.top
-
原垂直
+
y
me.left
=
me.left
-
原水平
+
x
form2.top
=
form2.top
-
原垂直
+
y
form2.left
=
form2.left
-
原水平
+
x
form3.top
=
form3.top
-
原垂直
+
y
form3.left
=
form3.left
-
原水平
+
x
end
sub
3、其他窗體基本都這樣。
網站標題:vbnet多窗口顯示的簡單介紹
URL標題:http://m.kartarina.com/article16/hegjgg.html
成都網站建設公司_創新互聯,為您提供虛擬主機、品牌網站設計、自適應網站、Google、網站維護、網站建設
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯