如何使用 visual basic 在 POS 软件中创建和显示客户屏幕

问题描述 投票:0回答:1

我正在使用 visual basic 构建一个 POS 软件,并尝试在面向客户的屏幕上显示客户屏幕。

使用的设备是 APT 200 系列 - 触摸屏 POS

我创建了一个客户表单并在主表单加载事件中使用了以下代码

        Dim secondaryDisplay As Screen = Screen.AllScreens(1)

        'Create a new form for the secondary display
        Dim customerscreen As New Form()

        'Set the form's properties to display on the secondary display
        customerscreen.StartPosition = FormStartPosition.Manual
        customerscreen.Location = secondaryDisplay.Bounds.Location
        customerscreen.WindowState = FormWindowState.Maximized
        customerscreen.FormBorderStyle = FormBorderStyle.None

        'Show the form on the secondary display
        customerscreen.Show()

但在下一行中显示以下错误

Dim secondaryDisplay As Screen = Screen.AllScreens(1)

索引超出数组范围。

任何人都可以帮忙吗

vb.net point-of-sale
1个回答
1
投票

这意味着它没有检测到辅助监视器。返回的数组仅包含 1 个监视器。这就是为什么你有

Index was outside the bounds of the array
。错误。

我建议你在尝试获取第二个屏幕之前检查数组的长度。 如果数组仅包含 1 个项目,则意味着您无法选择第二个屏幕值。

© www.soinside.com 2019 - 2024. All rights reserved.