From c12700214857fec14a8578d73b4a40b8399631ec Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Tue, 7 Nov 2017 20:24:22 +0100 Subject: [PATCH] Added method to automatically align all loaded devices --- RGB.NET.Core/RGBSurfaceDeviceLoader.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/RGB.NET.Core/RGBSurfaceDeviceLoader.cs b/RGB.NET.Core/RGBSurfaceDeviceLoader.cs index aa0ec63..ebe0ef6 100644 --- a/RGB.NET.Core/RGBSurfaceDeviceLoader.cs +++ b/RGB.NET.Core/RGBSurfaceDeviceLoader.cs @@ -42,6 +42,19 @@ namespace RGB.NET.Core } } + /// + /// Automatically aligns all devices to prevent overlaps. + /// + public void AlignDevies() + { + double posX = 0; + foreach (IRGBDevice device in Devices) + { + device.Location.X = posX; + posX += device.Size.Width + 1; + } + } + private void DeviceOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { if (string.Equals(propertyChangedEventArgs.PropertyName, nameof(IRGBDevice.Location)))