直接在屏幕上绘制数字/图形?

发布于 2024-12-10 22:32:27 字数 369 浏览 0 评论 0原文

我正在 Visual Basic Express 2010 中编写一个小程序,其中一部分是拍摄延迟的屏幕截图。

我已经让主要代码正常工作,我已经让 Visual Basic 延迟使用 System.Threading.Thread.CurrentThread.Sleep(5000) 进行屏幕截图,但我正在寻找一种直接绘制到屏幕的方法剩余秒数。

您知道在 Windows 中,在“设置”下的“显示属性”中,当您单击“识别”时,每个显示器上都会显示一个巨大的数字吗?

我正在尝试重新创建这一点,在拍摄屏幕截图之前进行倒计时,为用户提供足够的通知,让他们所需的应用程序成为屏幕截图的焦点。

可以这样做吗?还是需要大量编码?

非常感谢您提供的任何帮助

I'm putting together a small program in Visual Basic Express 2010, and part of it is to take a delayed screen shot.

I've got the main code working, I've got Visual Basic delaying taking the screen shot with System.Threading.Thread.CurrentThread.Sleep(5000), but what I'm looking for is a way to draw directly to the screen the number of seconds remaining.

You know how in Windows, in the Display Properties under Settings, when you click on Identify you get a huge number displayed on each monitor?

I'm trying to recreate that, with the number counting down until the screen shot is taken, giving the user plenty of notification to get their required applications in focus for the screen shot.

Is it possible to do this? Or is it something that will take a heck of a lot of coding?

Many thanks for any help you can offer

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄与心 2024-12-17 22:32:27

Form 中创建一个 Label 控件,并使用类似以下内容使其透明:

Me.TransparencyKey = Color.Gray ' or any other color.
Me.BackColor = TransparencyKey
Me.FormBorderStyle = FormBorderStyle.None

将制作如下内容:

Screenshot


要使窗口对鼠标透明,请 PInvoke GetWindowLongSetWindowLong

<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetWindowLong( _
 ByVal hWnd As IntPtr, _
 ByVal nIndex As Integer) As Integer
End Function

<DllImport("user32.dll")> _
Private Shared Function SetWindowLong( _
 ByVal hWnd As IntPtr, _
 ByVal nIndex As Integer, _
 ByVal dwNewLong As IntPtr) As Integer
End Function

然后在 Form_Load()< /代码> 添加以下:

Dim hwnd As IntPtr = Me.Handle
Dim extendedStyle As Integer = GetWindowLong(hwnd, GWL_EXSTYLE)
SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle Or WS_EX_TRANSPARENT)

常量:

Const WS_EX_TRANSPARENT As Integer = &H20
Const GWL_EXSTYLE As Integer = -20

Create a Label control in a Form and use something like the following to make it transparent:

Me.TransparencyKey = Color.Gray ' or any other color.
Me.BackColor = TransparencyKey
Me.FormBorderStyle = FormBorderStyle.None

will make something like this:

Screenshot


To make your window transparent to mouse, PInvoke GetWindowLong and SetWindowLong:

<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetWindowLong( _
 ByVal hWnd As IntPtr, _
 ByVal nIndex As Integer) As Integer
End Function

<DllImport("user32.dll")> _
Private Shared Function SetWindowLong( _
 ByVal hWnd As IntPtr, _
 ByVal nIndex As Integer, _
 ByVal dwNewLong As IntPtr) As Integer
End Function

Then in your Form_Load() add the following:

Dim hwnd As IntPtr = Me.Handle
Dim extendedStyle As Integer = GetWindowLong(hwnd, GWL_EXSTYLE)
SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle Or WS_EX_TRANSPARENT)

Constants:

Const WS_EX_TRANSPARENT As Integer = &H20
Const GWL_EXSTYLE As Integer = -20
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文