Windows OSD Nachrichten/Fenster in VB.NET

Sa, 27.06.2009 - 18:04 -- admin

Beschreibung

OSDExample ist ein beispielhaftes VB.NET Programm, dass zeigt wie eine OSD-Nachricht auf dem Bildschirm ausgegeben werden kann. Die Nachricht wird über alle Fenster hinweg gelegt, so dass der Text immer gelesen werden kann.
Die Anzeige wird über die Datei FloatingOSDWindow.dll realisiert. Sie liegt im kompilierten Zustand vor und kann per Verweis in jede .NET Anwendung eingebunden werden. Der in C# geschriebene Quellcode kann in den Verweisen über CodeProject bezogen werden oder direkt als fertiges C# Projekt hier heruntergeladen werden.

Klassen-Diagramm

Beispiel

Imports MrSmarty.CodeProject
[...]
Dim nWorkingWidth As Integer = Screen.PrimaryScreen.WorkingArea.Width
Dim nWorkingHeight As Integer = Screen.PrimaryScreen.WorkingArea.Height
 
'Top-left corner of text in screen coordinates
'Text at 50% of screenwith and at 80% from the top
Dim pt As Point = New Point((nWorkingHeight / 100) * 50, (nWorkingHeight / 100) * 80)
 
'Transparency of text
Dim alpha As Integer = 210
 
'Color of text
Dim textColor As Color = Color.LimeGreen
 
'Font of text
Dim textFont As New Font("Verdana", 25.0F, FontStyle.Bold Or FontStyle.Underline)
 
'How long text will be remain on screen, in millisecond
Dim showTimeMSec As Integer = 7000
 
'Effect to be applied. Work only if "time" greater than 0
Dim mode As FloatingWindow.AnimateMode = FloatingWindow.AnimateMode.Blend
 
'Time, in milliseconds, for effect playing. If this equal to 0 "mode" ignored and text showed at once
Dim time As Integer = 370
 
'Text to display
Dim text As String = txtOSDText.Text
 
Dim osd1 As New FloatingOSDWindow
osd1.Show(pt, alpha, textColor, textFont, showTimeMSec, mode, time, text)