/// <summary> /// Sets the position of the window based on the position of the TaskbarIcon in the system tray /// </summary> private void SetWindowLocation() { // TODO: Actually use real DPI var position = WindowPosition.GetWindowPosition(Tray, Width, Height, 1.0); Top = position.Y; Left = position.X; }
private void SetSizes() { Height = listDevices.Items.Count * listDevices.TileSize.Height + pictureItemsBack.ClientSize.Height + (IsWin10 ? 2 : SystemInformation.FrameBorderSize.Width * 2); pictureShadow.Top = pictureItemsBack.Top = ClientSize.Height - pictureItemsBack.ClientSize.Height; VolBar.Top = pictureItemsBack.Top + pictureItemsBack.Height / 2 - VolBar.Height / 2; ledLeft.Top = VolBar.Top - ledLeft.Height - 1; ledRight.Top = VolBar.Top + VolBar.Height + 1; var point = WindowPosition.GetWindowPosition(notifyIcon, Width, Height); Left = point.X; Top = point.Y; }
private void SetSizes() { Height = listDevices.Items.Count * listDevices.TileSize.Height + pictureItemsBack.ClientSize.Height + (IsWin10 ? 2 : SystemInformation.FrameBorderSize.Width * 2); listDevices.Height = pictureShadow.Top = pictureItemsBack.Top = ClientSize.Height - pictureItemsBack.ClientSize.Height; VolBar.Top = pictureItemsBack.Top + pictureItemsBack.Height / 2 - VolBar.Height / 2; ledLeft.Top = VolBar.Top - ledLeft.Height - 1; ledRight.Top = VolBar.Top + VolBar.Height + 1; if (Program.settings.AlwaysVisible) { return; } var point = WindowPosition.GetWindowPosition(notifyIcon, Width, Height); Left = point.X; // (int)(point.X / DpiFactor); Top = point.Y; // (int)(point.Y / DpiFactor); }
private void OpenAlwaysVisible() { if (Program.settings.FreePosLeft == 0 || Program.settings.FreePosTop == 0) { var point = WindowPosition.GetWindowPosition(notifyIcon, Width, Height); Left = point.X; Top = point.Y; } else { Left = Program.settings.FreePosLeft; Top = Program.settings.FreePosTop; } RenderType = Program.settings.DefaultDataFlow; RefreshDevices(RenderType); SetSizes(); VolBar.RegisterDevice(RenderType); timer1.Enabled = true; Show(); Activate(); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { defaultPosition?.GetWindowPosition(this); }