From a31b178d549a8ffd8abdf42f703d991bff4a24e2 Mon Sep 17 00:00:00 2001 From: Jarr3 Date: Sat, 20 Apr 2024 19:12:00 +0200 Subject: [PATCH] First try to control Snippet position --- .../b2sbackglassserver/Server.vb | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/b2sbackglassserver/b2sbackglassserver/Server.vb b/b2sbackglassserver/b2sbackglassserver/Server.vb index f0823a4..99cd032 100644 --- a/b2sbackglassserver/b2sbackglassserver/Server.vb +++ b/b2sbackglassserver/b2sbackglassserver/Server.vb @@ -2,6 +2,7 @@ Imports System.Text Imports System.Runtime.InteropServices Imports Microsoft.Win32 +Imports System.Drawing Public Class Server @@ -1684,6 +1685,14 @@ Public Class Server End If End If + End Sub + + Public Sub B2SSetPos(ByVal idORname As Object, ByVal xpos As Object, ByVal ypos As Object) + + If IsNumeric(idORname) And IsNumeric(xpos) And IsNumeric(ypos) Then + MyB2SSetPos(CInt(idORname), CInt(xpos), CInt(ypos)) + End If + End Sub ' pulse the set data Public Sub B2SPulseData(ByVal idORname As Object) @@ -2116,6 +2125,34 @@ Public Class Server ' B2SSettings.PluginHost.DataReceive("E", Convert.ToString(groupname), Convert.ToInt32(value)) 'End If + End Sub + Private Sub MyB2SSetPos(ByVal id As Integer, ByVal xpos As Integer, ByVal ypos As Integer) + + If B2SData.IsBackglassRunning Then + + If B2SData.IsBackglassStartedAsEXE Then + + Else + If B2SData.UsedRomLampIDs.ContainsKey(id) Then + For Each picbox As B2SPictureBox In B2SData.UsedRomLampIDs(id) + If picbox IsNot Nothing AndAlso (Not B2SData.UseIlluminationLocks OrElse String.IsNullOrEmpty(picbox.GroupName) OrElse Not B2SData.IlluminationLocks.ContainsKey(picbox.GroupName)) Then + picbox.Visible = picbox.Location.X Mod 6 > 0 ' This makes the picturebox blink, so that we see anything at all + + picbox.Left += xpos + picbox.Top += ypos + 'picbox.Location = New Point(xpos, picbox.Location.Y) 'this I have also tried, but it does not work either + + ' Different tries to invalidate the picturebox, so that it is repainted + picbox.Parent.Invalidate() + picbox.Parent.Update() + 'picbox.Invalidate() + End If + Next + End If + End If + + End If + End Sub Private Sub MyB2SSetLED(ByVal digit As Integer, ByVal value As Object)