'''?summary多屏顯示屏幕設(shè)置/summary
科爾沁右翼前網(wǎng)站制作公司哪家好,找成都創(chuàng)新互聯(lián)公司!從網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、APP開(kāi)發(fā)、響應(yīng)式網(wǎng)站設(shè)計(jì)等網(wǎng)站項(xiàng)目制作,到程序開(kāi)發(fā),運(yùn)營(yíng)維護(hù)。成都創(chuàng)新互聯(lián)公司2013年開(kāi)創(chuàng)至今到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來(lái)保證我們的工作的順利進(jìn)行。專(zhuān)注于網(wǎng)站建設(shè)就選成都創(chuàng)新互聯(lián)公司。
'''?param?name="obj"目標(biāo)窗體/param
'''?param?name="scrIndex"由0開(kāi)始的屏幕索引,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?=?"當(dāng)前屏幕索引超出范圍,是否要顯示在最后一個(gè)屏幕?"
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
多屏幕的顯示,屏幕的寬度相當(dāng)?shù)扔贜屏幕的寬度之和,更改窗體的X坐標(biāo)就能控制窗體顯示在哪個(gè)屏幕上。
兩個(gè)顯示器顯示有兩種模式,一種是
雙屏
復(fù)制,另一種是擴(kuò)展。
你這個(gè)只能用第二種方式。你需要把要在另一個(gè)顯示器上顯示的窗體的Location設(shè)置在主顯示器全屏?xí)r的右邊就可以了.其實(shí)就是桌面的向右延伸。
在主顯示上拖一下窗體就明白了!
在項(xiàng)目中右鍵點(diǎn)擊添加窗體。在代碼中需要顯示該窗體的地方寫(xiě)入如下代碼:“form2.show()”form2是你窗體的name屬性……
我做了幾行。
對(duì)無(wú)標(biāo)題欄的窗體,或者不從標(biāo)題欄移動(dòng)的情況下可用。
有標(biāo)題欄并且點(diǎn)住標(biāo)題欄移動(dòng)則不理想。
代碼如下,僅供參考。
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
'捕獲窗體移動(dòng)事件
sendmessage
bnhwnd,
wm_lbuttondown,
1,
sendmessage
bnhwnd,
wm_lbuttonup,
1,
'將消息發(fā)送到按紐,使其發(fā)生click事件
end
if
newproc
=
callwindowproc(oldproc,
hwnd,
msg,
wp,
lp)
end
function
2、在窗體上有一個(gè)按鈕(名稱(chēng)為eventbn)
dim
原垂直
as
single,
原水平
as
single
private
sub
eventbn_click()
msgbox
"移動(dòng)了"
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、其他窗體基本都這樣。
網(wǎng)站標(biāo)題:vbnet多窗口顯示的簡(jiǎn)單介紹
URL標(biāo)題:http://chinadenli.net/article16/hegjgg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、品牌網(wǎng)站設(shè)計(jì)、自適應(yīng)網(wǎng)站、Google、網(wǎng)站維護(hù)、網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
全網(wǎng)營(yíng)銷(xiāo)推廣知識(shí)