关于vbnet多窗口显示的信息

vb.net多屏时控制窗体显示在哪个显示器上

''' summary多屏显示屏幕设置/summary

创新互联公司-专业网站定制、快速模板网站建设、高性价比九江网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式九江网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖九江地区。费用合理售后完善,十载实体公司更值得信赖。

''' 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坐标就能控制窗体显示在哪个屏幕上。

VB中如何使多个窗口同步显示

我做了几行。

对无标题栏的窗体,或者不从标题栏移动的情况下可用。

有标题栏并且点住标题栏移动则不理想。

代码如下,仅供参考。

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、其他窗体基本都这样。

VB.NET中怎么实现双屏显示不同的窗体

两个显示器显示有两种模式,一种是

双屏

复制,另一种是扩展。

你这个只能用第二种方式。你需要把要在另一个显示器上显示的窗体的Location设置在主显示器全屏时的右边就可以了.其实就是桌面的向右延伸。

在主显示上拖一下窗体就明白了!

vb.net 怎么同时打开多个窗口?

在项目中右键点击添加窗体。在代码中需要显示该窗体的地方写入如下代码:“form2.show()”form2是你窗体的name属性……

网站栏目:关于vbnet多窗口显示的信息
链接URL:https://www.cdcxhl.com/article44/doegpee.html

成都网站建设公司_创新互联,为您提供域名注册面包屑导航营销型网站建设企业建站小程序开发标签优化

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

搜索引擎优化